private void onStartBuild(@NotNull Object buildId, @NotNull StartBuildEvent startBuildEvent) {
    Application application = ApplicationManager.getApplication();
    if (application.isHeadlessEnvironment() && !application.isUnitTestMode()) {
      return;
    }

    if (startBuildEvent instanceof StartBuildEventImpl) {
      myViewSettingsProvider = ((StartBuildEventImpl)startBuildEvent).getBuildViewSettingsProvider();
    }
    if (myViewSettingsProvider == null) {
      myViewSettingsProvider = () -> false;
    }
    if (myExecutionConsole == null) {
      Supplier<? extends RunContentDescriptor> descriptorSupplier = myBuildDescriptor.getContentDescriptorSupplier();
      RunContentDescriptor runContentDescriptor = descriptorSupplier != null ? descriptorSupplier.get() : null;
      myExecutionConsole = runContentDescriptor != null &&
                           runContentDescriptor.getExecutionConsole() != null &&
                           runContentDescriptor.getExecutionConsole() != this ?
                           runContentDescriptor.getExecutionConsole() : new BuildTextConsoleView(myProject, false,
                                                                                                 myBuildDescriptor.getExecutionFilters());
      if (runContentDescriptor != null && runContentDescriptor.getExecutionConsole() != this) {
        Disposer.register(this, runContentDescriptor);
      }
    }
    boolean buildTree = true;
    ExecutionConsole executionConsole = myExecutionConsole;
    if (executionConsole != null) {
      executionConsole.getComponent(); //create editor to be able to add console editor actions
      if (myViewSettingsProvider.isExecutionViewHidden()) {
        addViewAndShowIfNeeded(executionConsole, CONSOLE_VIEW_NAME, myViewManager.isConsoleEnabledByDefault(), false);
        buildTree = false;
      }
      else if (isShowInDashboard()) {
        ExecutionConsole consoleView =
          executionConsole instanceof ConsoleView ? wrapWithToolbar((ConsoleView)executionConsole) : executionConsole;
        addViewAndShowIfNeeded(consoleView, CONSOLE_VIEW_NAME, myViewManager.isConsoleEnabledByDefault(), false);
        if (executionConsole instanceof ConsoleViewImpl consoleViewImpl) {
          consoleViewImpl.getEditor().setBorder(IdeBorderFactory.createBorder(SideBorder.RIGHT));
        }
        buildTree = false;
      }
    }

    BuildTreeConsoleView eventView = null;
    if (buildTree) {
      eventView = getEventView();
      if (eventView == null) {
        String eventViewName = BuildTreeConsoleView.class.getName();
        eventView = new BuildTreeConsoleView(myProject, myBuildDescriptor, myExecutionConsole);
        addView(eventView, eventViewName);
        showView(eventViewName, false);
      }
    }

    BuildProcessHandler processHandler = myBuildDescriptor.getProcessHandler();
    if (myExecutionConsole instanceof ConsoleView consoleView) {
      if (!(consoleView instanceof BuildTextConsoleView)) {
        myBuildDescriptor.getExecutionFilters().forEach(consoleView::addMessageFilter);
      }

      if (processHandler != null) {
        assert consoleView != null;
        consoleView.attachToProcess(processHandler);
        Consumer<? super ConsoleView> attachedConsoleConsumer = myBuildDescriptor.getAttachedConsoleConsumer();
        if (attachedConsoleConsumer != null) {
          attachedConsoleConsumer.consume(consoleView);
        }
      }
    }
    if (processHandler != null && !processHandler.isStartNotified()) {
      processHandler.startNotify();
    }

    if (eventView != null) {
      eventView.onEvent(buildId, startBuildEvent);
    }
  }
private void onStartBuild(@NotNull Object buildId, @NotNull StartBuildEvent startBuildEvent)