private static void notifyUserIfNeeded(
      DataContext context,
      MavenProjectsManager projectsManager,
      List<VirtualFile> selectedFiles,
      VirtualFile pomXml) {
    MavenProject mavenProject = projectsManager.findProject(pomXml);
    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);
    }
  }
  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    final DataContext context = e.getDataContext();

    MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
    if (projectsManager == null) return;

    List<VirtualFile> selectedFiles = MavenActionUtil.getMavenProjectsFiles(context);
    List<VirtualFile> removableFiles = new ArrayList<>();

    for (VirtualFile pomXml : selectedFiles) {
      if (projectsManager.isManagedFile(pomXml)) {
        removableFiles.add(pomXml);
      } else {
        notifyUserIfNeeded(context, projectsManager, selectedFiles, pomXml);
      }
    }
    projectsManager.removeManagedFiles(removableFiles);
  }