MavenProjectsTreeUpdateResult (Collection<VirtualFile> files, boolean updateModules, boolean forceRead, MavenExplicitProfiles explicitProfiles, MavenProjectReader projectReader, MavenGeneralSettings generalSettings, ProgressIndicator process) { UpdateContext updateContext = new UpdateContext(); var updater = new MavenProjectsTreeUpdater(this, explicitProfiles, updateContext, projectReader, generalSettings, process, updateModules); var filesToAddModules = new HashSet<VirtualFile>(); for (VirtualFile file : files) { if (null == findProject(file)) { filesToAddModules.add(file); } updater.updateProjects(List.of(new UpdateSpec(file, forceRead))); } for (MavenProject aggregator : getProjects()) { for (VirtualFile moduleFile : aggregator.getExistingModuleFiles()) { if (filesToAddModules.contains(moduleFile)) { filesToAddModules.remove(moduleFile); var mavenProject = findProject(moduleFile); if (null != mavenProject) { if (reconnect(aggregator, mavenProject)) { updateContext.updated(mavenProject, MavenProjectChanges.NONE); } } } } } for (VirtualFile file : filesToAddModules) { var mavenProject = findProject(file); if (null != mavenProject) { addRootModule(mavenProject); } } updateExplicitProfiles(); updateContext.fireUpdatedIfNecessary(); return updateContext.toUpdateResult(); }