private void addRequest(@NotNull Runnable request, boolean urgent, boolean anyModality) {
    int delay = urgent ? 0 : myDelay;

    if (Alarm.ThreadToUse.SWING_THREAD.equals(myThreadToUse)) {
      if (anyModality) {
        myAlarm.addRequest(request, delay, ModalityState.any());
      }
      else if (!ApplicationManager.getApplication().isDispatchThread()) {
        myAlarm.addRequest(request, delay, ModalityState.nonModal());
      }
      else {
        myAlarm.addRequest(request, delay);
      }
    }
    else {
      myAlarm.addRequest(request, delay);
    }
  }
private void addRequest(@NotNull Runnable request, boolean urgent, boolean anyModality)