@ApiStatus.Internal
  public void performActivity(boolean userActivity, @NotNull Runnable runnable) {
    myErrorReported = false;
    boolean allowWriting = userActivity && isWriteSafeModality(ModalityState.current());
    if (myWritingAllowed == allowWriting) {
      runnable.run();
      return;
    }

    ThreadingAssertions.assertEventDispatchThread();
    boolean prev = myWritingAllowed;
    myWritingAllowed = allowWriting;
    try {
      runnable.run();
    }
    finally {
      myWritingAllowed = prev;
    }
  }
@ApiStatus.Internal
  public void performActivity(boolean userActivity, @NotNull Runnable runnable)