void (@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); if (!presentation.isVisible()) return; IdeView view = e.getData(LangDataKeys.IDE_VIEW); if (view == null) return; Project project = e.getProject(); if (project == null) return; ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex(); for (PsiDirectory dir : view.getDirectories()) { if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && checkPackageExists(dir)) { for (GroovySourceFolderDetector detector : GroovySourceFolderDetector.EP_NAME.getExtensions()) { if (detector.isGroovySourceFolder(dir)) { presentation.setWeight(Presentation.HIGHER_WEIGHT); break; } } return; } } }