private static void invokeWithLWCToolkit(Runnable r, Component invoker, boolean wait) {
    MethodHandle invokeMethod = getToolkitInvokeMethod(wait);
    if (invokeMethod == null) {
      return;
    }

    try {
      if (wait) {
        invokeMethod.invoke(r, invoker, true, -1);
      }
      else {
        invokeMethod.invoke(r, invoker);
      }
    }
    catch (Throwable e) {
      // suppress InvocationTargetException as in openjdk implementation (see com.apple.laf.ScreenMenu.java)
      getLogger().warn("invokeWithLWCToolkit.invokeAndWait: " + e);
    }
  }
private static void invokeWithLWCToolkit(Runnable r, Component invoker, boolean wait)