@Override
    public void accept(@NotNull Runnable continuation) {
      Project taskProject = myTask.getProject();
      if (taskProject != null && taskProject.isDisposed()) {
        continuation.run();
        return;
      }

      if (StringUtil.isEmptyOrSpaces(myTask.getTitle())) {
        myTask.setTitle(myTitle);
      }

      boolean synchronous =
        myTask.isHeadless() && !CoreProgressManager.shouldKeepTasksAsynchronousInHeadlessMode() && !myForceAsyncInTests ||
        myTask.isConditionalModal() && !myTask.shouldStartInBackground();

      if (synchronous) {
        try {
          getProgressManager().runProcessWithProgressSynchronously(myTask);
        }
        finally {
          continuation.run();
        }
      }
      else {
        getProgressManager().runProcessWithProgressAsynchronously(myTask,
                                                                  getIndicator(),
                                                                  continuation,
                                                                  myModalityState);
      }
    }
@Override
    public void accept(@NotNull Runnable continuation)