private void moveTabToNewIndexOrWindow(@NotNull TabInfo info, boolean movedFromOut) {
    IdeFrameImpl movedFrame = (IdeFrameImpl)info.getObject();
    int newIndex = getDropInfoIndex();
    assert newIndex != -1 : "Wrong Reordering";

    if (movedFromOut) {
      Foundation.executeOnMainThread(true, false, () -> {
        ID window = MacUtil.getWindowFromJavaWindow(myNativeWindow);
        ID tabGroup = Foundation.invoke(window, "tabGroup");
        ID tab = MacUtil.getWindowFromJavaWindow(movedFrame);
        Foundation.invoke(tabGroup, "insertWindow:atIndex:", tab, newIndex);
        Foundation.invoke(tabGroup, "setSelectedWindow:", tab);

        ApplicationManager.getApplication()
          .invokeLater(() -> MacWinTabsHandlerV2.updateTabBarsAfterMove(movedFrame, myNativeWindow, newIndex));
      });
    }
    else {
      info.setHidden(false);
      int oldIndex = myIndexes.get(movedFrame);

      if (oldIndex != newIndex) {
        reorderTab(info, newIndex);
        recalculateIndexes();
        moveTabToNewIndex(movedFrame, newIndex);
      }
    }
  }
private void moveTabToNewIndexOrWindow(@NotNull TabInfo info, boolean movedFromOut)