boolean () { final Pair<List<Pair<MavenProject, Module>>, List<Pair<MavenProject, Module>>> incompatible = collectIncompatibleModulesWithProjects(); final List<Pair<MavenProject, Module>> incompatibleMavenized = incompatible.first; final List<Pair<MavenProject, Module>> incompatibleNotMavenized = incompatible.second; if (incompatibleMavenized.isEmpty() && incompatibleNotMavenized.isEmpty()) return false; boolean changed = false; // For already mavenized modules the type may change because maven project plugins were resolved and MavenImporter asked to create a module of a different type. // In such cases we must change module type silently. for (Pair<MavenProject, Module> each : incompatibleMavenized) { myFileToModuleMapping.remove(each.first.getFile()); myModuleModel.disposeModule(each.second); changed = true; } if (incompatibleNotMavenized.isEmpty()) return changed; final int[] result = new int[]{Messages.OK}; if (!ApplicationManager.getApplication().isHeadlessEnvironment()) { MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), () -> { String message = MavenProjectBundle.message("maven.import.incompatible.modules", incompatibleNotMavenized.size(), formatProjectsWithModules(incompatibleNotMavenized)); String[] options = { MavenProjectBundle.message("maven.import.incompatible.modules.recreate"), MavenProjectBundle.message("maven.import.incompatible.modules.ignore") }; result[0] = Messages.showOkCancelDialog(myProject, message, MavenProjectBundle.message("maven.project.import.title"), options[0], options[1], Messages.getQuestionIcon()); }); } if (result[0] == Messages.OK) { for (Pair<MavenProject, Module> each : incompatibleNotMavenized) { myFileToModuleMapping.remove(each.first.getFile()); myModuleModel.disposeModule(each.second); } changed = true; } else { myProjectsTree.setIgnoredState(MavenUtil.collectFirsts(incompatibleNotMavenized), true, true); } return changed; }