public static void runWhenFirstShown(@NotNull JComponent component, @NotNull Runnable runnable) {
    if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
      runnable.run();
    }
    else {
      UiNotifyConnector.doWhenFirstShown(component, runnable);
    }
  }
public static void runWhenFirstShown(@NotNull JComponent component, @NotNull Runnable runnable)