public static @Nullable <T> T withTimeout(long timeoutMs, @NotNull Computable<T> computation) {
    ProgressManager.checkCanceled();
    ProgressIndicator outer = ProgressIndicatorProvider.getGlobalProgressIndicator();
    ProgressIndicator inner = outer != null ? new SensitiveProgressWrapper(outer) : new ProgressIndicatorBase(false, false);
    AtomicBoolean canceledByTimeout = new AtomicBoolean();
    ScheduledFuture<?> cancelProgress = AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> {
      canceledByTimeout.set(true);
      inner.cancel();
    }, timeoutMs, TimeUnit.MILLISECONDS);
    try {
      return ProgressManager.getInstance().runProcess(computation, inner);
    }
    catch (ProcessCanceledException e) {
      if (canceledByTimeout.get()) {
        return null;
      }
      throw e; // canceled not by timeout
    }
    finally {
      cancelProgress.cancel(false);
    }
  }
public static @Nullable <T> T withTimeout(long timeoutMs, @NotNull Computable<T> computation)