void (@NotNull AnActionEvent e) { final DataContext context = e.getDataContext(); final Project project = getProject(context); if (project == null) { return; } MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(project); List<VirtualFile> selectedFiles = MavenActionUtil.getMavenProjectsFiles(context); projectsManager.removeManagedFiles(selectedFiles, (mavenProject) -> { assert mavenProject != null; MavenProject aggregator = projectsManager.findAggregator(mavenProject); while (aggregator != null && !projectsManager.isManagedFile(aggregator.getFile())) { aggregator = projectsManager.findAggregator(aggregator); } if (aggregator != null && !selectedFiles.contains(aggregator.getFile())) { notifyUser(context, mavenProject, aggregator); } }, (names) -> { int returnCode = Messages .showOkCancelDialog(ExternalSystemBundle.message("action.detach.external.confirmation.prompt", "Maven", names.size(), names), getActionTitle(names), CommonBundle.message("button.remove"), CommonBundle.getCancelButtonText(), Messages.getQuestionIcon()); if (returnCode != Messages.OK) { return false; } return true; }); }