use of com.google.idea.blaze.base.scope.scopes.ToolWindowScope in project intellij by bazelbuild.
the class BlazeIdeInterfaceAspectsImpl method setupToolWindow.
private static void setupToolWindow(Project project, BlazeContext parentContext, BlazeContext childContext, WorkspaceRoot workspaceRoot, String taskName, boolean isSync) {
ContextType contextType = isSync ? ContextType.Sync : ContextType.Other;
Task.Type taskType = isSync ? Task.Type.BLAZE_SYNC : Task.Type.BLAZE_MAKE;
ToolWindowScope parentToolWindowScope = parentContext.getScope(ToolWindowScope.class);
Task parentTask = parentToolWindowScope != null ? parentToolWindowScope.getTask() : null;
childContext.push(new ToolWindowScope.Builder(project, new Task(taskName, taskType, parentTask)).setIssueParsers(BlazeIssueParser.defaultIssueParsers(project, workspaceRoot, contextType)).build());
if (BlazeConsoleExperimentManager.isBlazeConsoleV2Enabled()) {
childContext.push(new BlazeConsoleScope.Builder(project).addConsoleFilters(new IssueOutputFilter(project, workspaceRoot, contextType, true)).setClearPreviousState(false).build());
}
}
use of com.google.idea.blaze.base.scope.scopes.ToolWindowScope in project intellij by bazelbuild.
the class SyncPhaseCoordinator method queueUpdateTask.
private void queueUpdateTask(UpdatePhaseTask task, @Nullable ToolWindowScope syncToolWindowScope, BlazeSyncParams params) {
synchronized (this) {
if (pendingUpdateTask != null) {
// there's already a pending job, no need to kick off another one
pendingUpdateTask = UpdatePhaseTask.combineTasks(pendingUpdateTask, task);
return;
}
pendingUpdateTask = task;
}
Task toolWindowTask;
boolean startTaskOnScopeBegin;
if (syncToolWindowScope == null) {
toolWindowTask = new Task(params.title(), Task.Type.BLAZE_SYNC);
startTaskOnScopeBegin = true;
} else {
toolWindowTask = syncToolWindowScope.getTask();
syncToolWindowScope.setFinishTaskOnScopeEnd(false);
startTaskOnScopeBegin = false;
}
ProgressiveTaskWithProgressIndicator.builder(project, "Syncing Project").setExecutor(singleThreadedExecutor).submitTaskLater(indicator -> Scope.root(context -> {
UpdatePhaseTask updateTask = getAndClearPendingTask();
setupScopes(updateTask.syncParams(), context, indicator, SyncPhase.PROJECT_UPDATE, toolWindowTask, startTaskOnScopeBegin);
updateProjectAndFinishSync(updateTask, context);
}));
}
Aggregations