boolean (@NotNull List<Module> obsoleteModules) { if (obsoleteModules.isEmpty()) { return false; } String message = MavenProjectBundle.message("maven.import.message.delete.obsolete", formatModules(obsoleteModules)); MavenLog.LOG.warn("Asking about deleting obsolete modules. " + message); if (null != answerToDeleteObsoleteModulesQuestion) { var delete = answerToDeleteObsoleteModulesQuestion; MavenLog.LOG.warn("This should only happen in tests. Delete obsolete modules: " + delete); answerToDeleteObsoleteModulesQuestion = null; return delete; } if (!ApplicationManager.getApplication().isHeadlessEnvironment() || MavenUtil.isMavenUnitTestModeEnabled()) { final int[] result = new int[1]; MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), () -> result[0] = Messages.showYesNoDialog(myProject, message, MavenProjectBundle.message("maven.project.import.title"), Messages.getQuestionIcon())); if (result[0] == Messages.NO) { return false; } } return true; }