private static @NotNull DefaultBuildDescriptor createSyncDescriptor(
    @NotNull String externalProjectPath,
    @NotNull ImportSpec importSpec,
    @NotNull ExternalSystemResolveProjectTask resolveProjectTask,
    @NotNull ExternalSystemProcessHandler processHandler,
    @Nullable ExecutionConsole consoleView,
    @NotNull ExternalSystemExecutionConsoleManager<ExecutionConsole, ProcessHandler> consoleManager
  ) {
    var project = importSpec.getProject();
    var taskId = resolveProjectTask.getId();
    var externalSystemId = taskId.getProjectSystemId();
    var rerunImportAction = new DumbAwareAction() {

      @Override
      public void update(@NotNull AnActionEvent e) {
        e.getPresentation().setEnabled(processHandler.isProcessTerminated());
      }

      @Override
      public @NotNull ActionUpdateThread getActionUpdateThread() {
        return ActionUpdateThread.EDT;
      }

      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        e.getPresentation().setEnabled(false);
        Runnable rerunRunnable = importSpec instanceof ImportSpecImpl ? ((ImportSpecImpl)importSpec).getRerunAction() : null;
        if (rerunRunnable == null) {
          refreshProject(externalProjectPath, importSpec);
        }
        else {
          rerunRunnable.run();
        }
      }
    };
    var systemId = externalSystemId.getReadableName();
    rerunImportAction.getTemplatePresentation()
      .setText(ExternalSystemBundle.messagePointer("action.refresh.project.text", systemId));
    rerunImportAction.getTemplatePresentation()
      .setDescription(ExternalSystemBundle.messagePointer("action.refresh.project.description", systemId));
    rerunImportAction.getTemplatePresentation().setIcon(AllIcons.Actions.Refresh);
    var projectName = resolveProjectTask.getProjectName();
    return new DefaultBuildDescriptor(taskId, projectName, externalProjectPath, System.currentTimeMillis())
      .withProcessHandler(processHandler, null)
      .withRestartAction(rerunImportAction)
      .withContentDescriptor(() -> {
        if (consoleView == null) return null;
        BuildContentDescriptor contentDescriptor = new BuildContentDescriptor(
          consoleView, processHandler, consoleView.getComponent(),
          ExternalSystemBundle.message("build.event.title.sync")
        );
        contentDescriptor.setActivateToolWindowWhenAdded(importSpec.isActivateBuildToolWindowOnStart());
        contentDescriptor.setActivateToolWindowWhenFailed(importSpec.isActivateBuildToolWindowOnFailure());
        contentDescriptor.setNavigateToError(importSpec.isNavigateToError());
        contentDescriptor.setAutoFocusContent(importSpec.isActivateBuildToolWindowOnFailure());
        return contentDescriptor;
      })
      .withActions(consoleManager.getCustomActions(project, resolveProjectTask, null))
      .withContextActions(consoleManager.getCustomContextActions(project, resolveProjectTask, null))
      .withExecutionFilters(consoleManager.getCustomExecutionFilters(project, resolveProjectTask, null));
  }
private static @NotNull DefaultBuildDescriptor createSyncDescriptor(
    @NotNull String externalProjectPath,
    @NotNull ImportSpec importSpec,
    @NotNull ExternalSystemResolveProjectTask resolveProjectTask,
    @NotNull ExternalSystemProcessHandler processHandler,
    @Nullable ExecutionConsole consoleView,
    @NotNull ExternalSystemExecutionConsoleManager<ExecutionConsole, ProcessHandler> consoleManager
  )