List<VirtualFile> (@NotNull AnActionEvent e) { final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); final Project project = getEventProject(e); if (project == null || files == null || files.length == 0) { return Collections.emptyList(); } List<VirtualFile> modulesFiles = new ArrayList<>(); for (VirtualFile file : files) { if (!FileTypeRegistry.getInstance().isFileOfType(file, ModuleFileType.INSTANCE)) { return Collections.emptyList(); } modulesFiles.add(file); } final ModuleManager moduleManager = ModuleManager.getInstance(project); for (Module module : moduleManager.getModules()) { modulesFiles.remove(module.getModuleFile()); } return modulesFiles; }