use of com.google.idea.blaze.base.projectview.ProjectViewEdit in project intellij by bazelbuild.
the class SuggestBuildShardingNotification method editProjectViewAndResync.
private static void editProjectViewAndResync(Project project, ProjectViewEditor editor) {
ProjectViewEdit edit = ProjectViewEdit.editLocalProjectView(project, editor);
if (edit == null) {
Messages.showErrorDialog("Could not modify project view. Check for errors in your project view and try again", "Error");
return;
}
edit.apply();
BlazeSyncManager.getInstance(project).incrementalProjectSync();
}
use of com.google.idea.blaze.base.projectview.ProjectViewEdit in project intellij by bazelbuild.
the class AddLibraryTargetDirectoryToProjectViewAction method addDirectoriesToProjectView.
static void addDirectoriesToProjectView(Project project, List<Library> libraries) {
Set<WorkspacePath> workspacePaths = Sets.newHashSet();
for (Library library : libraries) {
WorkspacePath workspacePath = getDirectoryToAddForLibrary(project, library);
if (workspacePath != null) {
workspacePaths.add(workspacePath);
}
}
ProjectViewEdit edit = ProjectViewEdit.editLocalProjectView(project, builder -> {
ListSection<DirectoryEntry> existingSection = builder.getLast(DirectorySection.KEY);
ListSection.Builder<DirectoryEntry> directoryBuilder = ListSection.update(DirectorySection.KEY, existingSection);
for (WorkspacePath workspacePath : workspacePaths) {
directoryBuilder.add(new DirectoryEntry(workspacePath, true));
}
builder.replace(existingSection, directoryBuilder);
return true;
});
if (edit == null) {
Messages.showErrorDialog("Could not modify project view. Check for errors in your project view and try again", "Error");
return;
}
edit.apply();
BlazeSyncManager.getInstance(project).requestProjectSync(new BlazeSyncParams.Builder("Adding Library", BlazeSyncParams.SyncMode.INCREMENTAL).addProjectViewTargets(true).addWorkingSet(BlazeUserSettings.getInstance().getExpandSyncToWorkingSet()).build());
}
use of com.google.idea.blaze.base.projectview.ProjectViewEdit in project intellij by bazelbuild.
the class AlwaysPresentGoSyncPlugin method fixLanguageSupport.
private static void fixLanguageSupport(Project project) {
ProjectViewEdit edit = ProjectViewEdit.editLocalProjectView(project, builder -> {
removeGoWorkspaceType(builder);
addToAdditionalLanguages(builder);
return true;
});
if (edit == null) {
Messages.showErrorDialog("Could not modify project view. Check for errors in your project view and try again", "Error");
return;
}
edit.apply();
BlazeSyncManager.getInstance(project).incrementalProjectSync();
}
Aggregations