boolean (Object element, @Nullable PsiElement context) { if (element instanceof PsiPackage) { return ((PsiDirectoryContainer)element).getDirectories(myScope).length > 0; } else if (element instanceof PsiElement) { PsiFile psiFile = ((PsiElement)element).getContainingFile(); if (psiFile != null) { VirtualFile file = psiFile.getVirtualFile(); return file != null && myScope.contains(file); } } return false; }