void (@NotNull AnActionEvent e) { Project project = e.getProject(); ProjectFileIndex index = project == null ? null : ProjectFileIndex.getInstance(project); JBIterable<VirtualFile> files = JBIterable.of(e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)); boolean enabled = index != null && files.isNotEmpty() && files.filter(o -> !index.isInContent(o)).isEmpty(); e.getPresentation().setEnabledAndVisible(enabled); }