void (@NotNull Object buildId, @NotNull BuildEvent event) { if (buildId != task.getId()) return; if (event instanceof FinishBuildEvent) { Disposer.dispose(disposable); } else if (event instanceof StartBuildEvent) { // override start build event to use different execution console, toolbar actions etc. BuildDescriptor buildDescriptor = ((StartBuildEvent)event).getBuildDescriptor(); DefaultBuildDescriptor defaultBuildDescriptor = new DefaultBuildDescriptor(buildDescriptor.getId(), buildDescriptor.getTitle(), buildDescriptor.getWorkingDir(), buildDescriptor.getStartTime()); // do not open Build tw for any error messages as it can be tests failure events defaultBuildDescriptor.setActivateToolWindowWhenFailed(false); event = new StartBuildEventImpl(defaultBuildDescriptor, event.getMessage()); } buildViewManager.onEvent(buildId, event); if (event instanceof StartEvent) { ProgressBuildEventImpl progressBuildEvent = new ProgressBuildEventImpl(event.getId(), event.getParentId(), event.getEventTime(), event.getMessage(), -1, -1, ""); progressBuildEvent.setHint("- " + GradleBundle.message("gradle.test.runner.build.tw.link.title")); buildViewManager.onEvent(buildId, progressBuildEvent); } maybeOpenBuildToolWindow(event, project, testsRootNode); }