@Override
  protected void doDetachModules(@NotNull Project project,
                                 Module @Nullable [] modules,
                                 @Nullable List<? extends UnloadedModuleDescription> unloadedModules) {
    var mavenProjectsToIgnore = new ArrayList<MavenProject>();
    var projectsManager = MavenProjectsManager.getInstance(project);
    if (null != modules) {
      for (var module : modules) {
        var mavenProject = projectsManager.findProject(module);
        if (null != mavenProject) {
          mavenProjectsToIgnore.add(mavenProject);
        }
      }
    }

    super.doDetachModules(project, modules, unloadedModules);

    projectsManager.setIgnoredState(mavenProjectsToIgnore, true);
  }
@Override
  protected void doDetachModules(@NotNull Project project,
                                 Module @Nullable [] modules,
                                 @Nullable List<? extends UnloadedModuleDescription> unloadedModules)