final DataContext context = e.getDataContext();
Module module = (Module) context.getData(DataKeys.MODULE.getName());
if (!ClojureUtils.isSuitableModule(module)) {
return false;
}
final IdeView view = (IdeView) context.getData(DataKeys.IDE_VIEW.getName());
final Project project = (Project) context.getData(DataKeys.PROJECT.getName());
if (view != null && project != null) {
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
PsiDirectory[] dirs = view.getDirectories();
for (PsiDirectory dir : dirs) {
PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(dir);
if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && aPackage != null) {
return true;
}