private void executeInImpatientReadAction(@NotNull Runnable runnable) {
    ApplicationEx application = ApplicationManagerEx.getApplicationEx();
    boolean shouldFailFastAcquiringReadAction = application.isInImpatientReader();

    AstLoadingFilter.disallowTreeLoading(() -> AstLoadingFilter.<Boolean, RuntimeException>forceAllowTreeLoading(myPsiFile, () -> {
      if (shouldFailFastAcquiringReadAction) {
        application.executeByImpatientReader(() -> {
          if (!application.tryRunReadAction(runnable)) {
            throw new ProcessCanceledException();
          }
        });
      }
      else {
        if (!application.tryRunReadAction(runnable)) {
          throw new ProcessCanceledException();
        }
      }
      return true;
    }));
  }
private void executeInImpatientReadAction(@NotNull Runnable runnable)