private static void mergeAllWindows(@NotNull Window window, boolean updateTabBars) {
    for (IdeFrame helper : WindowManager.getInstance().getAllProjectFrames()) {
      IdeFrameImpl frame = ((ProjectFrameHelper)helper).getFrame();
      if (frame != window && helper.isInFullScreen()) {
        frame.getRootPane().putClientProperty(MacMainFrameDecorator.IGNORE_EXIT_FULL_SCREEN, true);
      }
    }

    Foundation.executeOnMainThread(true, false, () -> {
      ID id = MacUtil.getWindowFromJavaWindow(window);
      Foundation.invoke(id, "mergeAllWindows:", ID.NIL);
      if (MacWinTabsHandler.isVersion2()) {
        ApplicationManager.getApplication().invokeLater(() -> MacWinTabsHandlerV2.updateTabBarsAfterMerge());
      }
      else if (updateTabBars) {
        ApplicationManager.getApplication().invokeLater(() -> MacWinTabsHandler.updateTabBars(null));
      }
    });
  }
private static void mergeAllWindows(@NotNull Window window, boolean updateTabBars)