public static void invokeAndWaitIfNeeded(@NotNull Runnable runnable) {
    if (EDT.isCurrentThreadEdt()) {
      runnable.run();
    }
    else {
      try {
        getInstance().invokeAndWait(runnable);
      }
      catch (Exception e) {
        Logger.getInstance(EdtInvocationManager.class).error(e);
      }
    }
  }
public static void invokeAndWaitIfNeeded(@NotNull Runnable runnable)