public void doRun(@NotNull ProgressIndicator indicator) {
    final SequentialTask task = myTask;
    if (task == null) {
      return;
    }

    myIndicator = indicator;
    indicator.setIndeterminate(false);
    prepare(task);

    // We need to sync background thread and EDT here in order to avoid a situation when event queue is full of processing requests.
    while (!task.isDone()) {
      if (indicator.isCanceled()) {
        task.stop();
        break;
      }
      ApplicationManager.getApplication().invokeAndWait(() -> {
        long start = System.currentTimeMillis();
        try {
          while (!task.isDone() && System.currentTimeMillis() - start < myMinIterationTime) {
            task.iteration(indicator);
          }
        }
        catch (RuntimeException e) {
          task.stop();
          throw e;
        }
      });
    }
  }
public void doRun(@NotNull ProgressIndicator indicator)