void (@NotNull AnActionEvent e) { final Project project = getEventProject(e); boolean visible = false; if (project != null && ModuleManager.getInstance(project).getModules().length > 0) { final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); for (VirtualFile root : getRoots(e)) { if (!root.isInLocalFileSystem() && FileUtilRt.extensionEquals(root.getName(), "jar") && !fileIndex.isInLibraryClasses(root)) { visible = true; break; } if (root.isInLocalFileSystem() && root.isDirectory()) { for (VirtualFile child : root.getChildren()) { if (FileUtilRt.extensionEquals(child.getName(), "jar")) { final VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(child); if (jarRoot != null && !fileIndex.isInLibraryClasses(child)) { visible = true; break; } } } } } } e.getPresentation().setEnabledAndVisible(visible); }