public static @NotNull ID getWindowFromJavaWindow(@Nullable Window w) {
    if (w == null) {
      return ID.NIL;
    }
    if (SystemInfo.isJetBrainsJvm) {
      try {
        Object cPlatformWindow = getPlatformWindow(w);
        if (cPlatformWindow != null) {
          Field ptr = cPlatformWindow.getClass().getSuperclass().getDeclaredField("ptr");
          ptr.setAccessible(true);
          return new ID(ptr.getLong(cPlatformWindow));
        }
      }
      catch (IllegalAccessException | NoSuchFieldException e) {
        LOG.debug(e);
      }
    }
    return ID.NIL;
  }
public static @NotNull ID getWindowFromJavaWindow(@Nullable Window w)