boolean (SearchScope scope) { if (!(scope instanceof LocalSearchScope localSearchScope)) return true; final PsiElement[] elements = localSearchScope.getScope(); for (final PsiElement element : elements) { if (element instanceof PsiDirectory) return true; boolean isForm = ReadAction.compute(() -> { PsiFile file; if (element instanceof PsiFile) { file = (PsiFile)element; } else { if (!element.isValid()) return false; file = element.getContainingFile(); } return file.getFileType() == GuiFormFileType.INSTANCE; }); if (isForm) return true; } return false; }