use of org.jetbrains.idea.maven.project.MavenImportingSettings in project intellij-community by JetBrains.
the class MavenFoldersImporter method updateProjectFolders.
public static void updateProjectFolders(final Project project, final boolean updateTargetFoldersOnly) {
final MavenProjectsManager manager = MavenProjectsManager.getInstance(project);
final MavenImportingSettings settings = manager.getImportingSettings();
WriteAction.run(() -> {
List<ModifiableRootModel> rootModels = new ArrayList<>();
for (Module each : ModuleManager.getInstance(project).getModules()) {
MavenProject mavenProject = manager.findProject(each);
if (mavenProject == null)
continue;
MavenRootModelAdapter a = new MavenRootModelAdapter(mavenProject, each, new IdeModifiableModelsProviderImpl(project));
new MavenFoldersImporter(mavenProject, settings, a).config(updateTargetFoldersOnly);
ModifiableRootModel model = a.getRootModel();
if (model.isChanged()) {
rootModels.add(model);
} else {
model.dispose();
}
}
if (!rootModels.isEmpty()) {
ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels.get((0)).getProject()).getModifiableModel());
}
});
}
Aggregations