void (@NotNull DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); assert project != null; final Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext); List<UnloadedModuleDescription> unloadedModules = ProjectView.UNLOADED_MODULES_CONTEXT_KEY.getData(dataContext); Set<String> moduleNamesToDelete = getModuleNamesToDelete(modules, unloadedModules); String names = StringUtil.join(moduleNamesToDelete, name -> "'" + name + "'", ", "); String dialogTitle = StringUtil.trimEnd(getActionTitle(), "..."); int ret = Messages.showOkCancelDialog(getConfirmationText(names, moduleNamesToDelete.size()), dialogTitle, CommonBundle.message("button.remove"), CommonBundle.getCancelButtonText(), Messages.getQuestionIcon()); if (ret != Messages.OK) return; CommandProcessor.getInstance().executeCommand(project, () -> { final Runnable action = () -> { detachModules(project, modules, unloadedModules); }; ApplicationManager.getApplication().runWriteAction(action); }, ProjectBundle.message("module.remove.command"), null); }