List<VirtualFile> (MavenProject mavenProject, List<VirtualFile> existingModuleFiles) { var modulesFilesToReconnect = new ArrayList<VirtualFile>(); for (VirtualFile moduleFile : existingModuleFiles) { MavenProject foundModule = tree.findProject(moduleFile); boolean isNewModule = foundModule == null; if (!isNewModule) { MavenProject currentAggregator = tree.findAggregator(foundModule); if (currentAggregator != null && currentAggregator != mavenProject) { MavenLog.LOG.info("Module " + moduleFile + " is already included into " + mavenProject.getFile()); continue; } } modulesFilesToReconnect.add(moduleFile); } return modulesFilesToReconnect; }