private boolean checkIfForceDirectExecNeeded() {
    if (!EDT.isCurrentThreadEdt()) {
      return false;
    }
    if (isSync && !ApplicationManager.getApplication().isWriteIntentLockAcquired()) {
      throw new IllegalStateException("Running sync tasks on pure EDT (w/o IW lock) is dangerous for several reasons.");
    }
    if (!isSync && isModal) {
      throw new IllegalStateException("Running async modal tasks from EDT is impossible: modal implies sync dialog show + polling events");
    }
    boolean forceDirectExec = isSync && (ApplicationManager.getApplication().isWriteAccessAllowed() || !isModal);
    if (forceDirectExec) {
      String reason = ApplicationManager.getApplication().isWriteAccessAllowed() ? "inside Write Action" : "not modal execution";
      @NonNls String failedConstraints = "";
      if (isModal) failedConstraints += "Use Modal execution; ";
      if (myThreadToUse == ThreadToUse.POOLED) failedConstraints += "Use pooled thread; ";
      failedConstraints = failedConstraints.isEmpty() ? "none" : failedConstraints;
      Logger.getInstance(ProgressRunner.class)
        .warn("Forced to sync exec on EDT. Reason: " + reason + ". Failed constraints: " + failedConstraints, new Throwable());
    }
    return forceDirectExec;
  }
private boolean checkIfForceDirectExecNeeded()