boolean (VirtualFile file) { final Object value = getValue(); if (value instanceof PsiElement element) { final boolean equalContainingFile = Comparing.equal(PsiUtilCore.getVirtualFile(element), file); if (equalContainingFile) return true; } if (value instanceof PsiDirectory directory) { return contains(file, directory); } else if (value instanceof PsiDirectoryContainer container) { final PsiDirectory[] directories = container.getDirectories(); for (PsiDirectory directory : directories) { if (contains(file, directory)) return true; } } return false; }