Search in sources :

Example 1 with ToolWindowScope

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());
    }
}
Also used : ContextType(com.google.idea.blaze.base.command.BlazeInvocationContext.ContextType) Task(com.google.idea.blaze.base.toolwindow.Task) IssueOutputFilter(com.google.idea.blaze.base.issueparser.IssueOutputFilter) ToolWindowScope(com.google.idea.blaze.base.scope.scopes.ToolWindowScope)

Example 2 with ToolWindowScope

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);
    }));
}
Also used : ProblemsViewScope(com.google.idea.blaze.base.scope.scopes.ProblemsViewScope) ModuleFinder(com.google.idea.blaze.base.sync.projectstructure.ModuleFinder) BuildResult(com.google.idea.blaze.base.sync.aspects.BuildResult) ProjectViewManager(com.google.idea.blaze.base.projectview.ProjectViewManager) IdeaLogScope(com.google.idea.blaze.base.scope.scopes.IdeaLogScope) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) Future(java.util.concurrent.Future) BlazeConsoleScope(com.google.idea.blaze.base.scope.scopes.BlazeConsoleScope) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Duration(java.time.Duration) Map(java.util.Map) SaveUtil(com.google.idea.blaze.base.util.SaveUtil) AppExecutorUtil(com.intellij.util.concurrency.AppExecutorUtil) Task(com.google.idea.blaze.base.toolwindow.Task) Logger(com.intellij.openapi.diagnostic.Logger) Module(com.intellij.openapi.module.Module) Blaze(com.google.idea.blaze.base.settings.Blaze) ImmutableSet(com.google.common.collect.ImmutableSet) Predicate(java.util.function.Predicate) PrintOutput(com.google.idea.blaze.base.scope.output.PrintOutput) Instant(java.time.Instant) GuardedBy(javax.annotation.concurrent.GuardedBy) Collectors.joining(java.util.stream.Collectors.joining) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) Executors(java.util.concurrent.Executors) IssueOutputFilter(com.google.idea.blaze.base.issueparser.IssueOutputFilter) ProjectTargetData(com.google.idea.blaze.base.model.ProjectTargetData) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) List(java.util.List) FocusBehavior(com.google.idea.blaze.base.settings.BlazeUserSettings.FocusBehavior) ServiceManager(com.intellij.openapi.components.ServiceManager) ImportSection(com.google.idea.blaze.base.projectview.section.sections.ImportSection) AutoValue(com.google.auto.value.AutoValue) ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) BlazeProjectDataManagerImpl(com.google.idea.blaze.base.sync.data.BlazeProjectDataManagerImpl) TargetKey(com.google.idea.blaze.base.ideinfo.TargetKey) ToolWindowScope(com.google.idea.blaze.base.scope.scopes.ToolWindowScope) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) ExperimentScope(com.google.idea.blaze.base.experiments.ExperimentScope) NotificationScope(com.google.idea.blaze.base.scope.scopes.NotificationScope) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) TimedEvent(com.google.idea.blaze.base.scope.scopes.TimingScopeListener.TimedEvent) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ContextType(com.google.idea.blaze.base.command.BlazeInvocationContext.ContextType) PerformanceWarningScope(com.google.idea.blaze.base.scope.scopes.PerformanceWarningScope) StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput) SyncStats(com.google.idea.blaze.base.logging.utils.SyncStats) ProgressIndicatorScope(com.google.idea.blaze.base.scope.scopes.ProgressIndicatorScope) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) ImmutableList(com.google.common.collect.ImmutableList) Scope(com.google.idea.blaze.base.scope.Scope) BlazeDataStorage(com.google.idea.blaze.base.sync.data.BlazeDataStorage) IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Project(com.intellij.openapi.project.Project) Nullable(javax.annotation.Nullable) BlazeLibraryCollector(com.google.idea.blaze.base.sync.libraries.BlazeLibraryCollector) BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) SyncFailedException(com.google.idea.blaze.base.sync.SyncScope.SyncFailedException) BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings) TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) ConcurrencyUtil(com.google.idea.common.util.ConcurrencyUtil) BlazeIssueParser(com.google.idea.blaze.base.issueparser.BlazeIssueParser) EventLoggingService(com.google.idea.blaze.base.logging.EventLoggingService) Preconditions(com.google.common.base.Preconditions) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ProgressiveTaskWithProgressIndicator(com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator) EventType(com.google.idea.blaze.base.scope.scopes.TimingScope.EventType) Task(com.google.idea.blaze.base.toolwindow.Task)

Aggregations

ContextType (com.google.idea.blaze.base.command.BlazeInvocationContext.ContextType)2 IssueOutputFilter (com.google.idea.blaze.base.issueparser.IssueOutputFilter)2 ToolWindowScope (com.google.idea.blaze.base.scope.scopes.ToolWindowScope)2 AutoValue (com.google.auto.value.AutoValue)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)1 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)1 ProgressiveTaskWithProgressIndicator (com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator)1 ExperimentScope (com.google.idea.blaze.base.experiments.ExperimentScope)1 TargetKey (com.google.idea.blaze.base.ideinfo.TargetKey)1 BlazeIssueParser (com.google.idea.blaze.base.issueparser.BlazeIssueParser)1 EventLoggingService (com.google.idea.blaze.base.logging.EventLoggingService)1 SyncStats (com.google.idea.blaze.base.logging.utils.SyncStats)1 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)1 ProjectTargetData (com.google.idea.blaze.base.model.ProjectTargetData)1 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)1