void (IdeFrameImpl @NotNull [] tabFrames) { for (IdeFrameImpl tabFrame : tabFrames) { createTabItem(tabFrame, -1, tabFrame == myNativeWindow); } recalculateIndexes(); setSelectionChangeHandler((info, requestFocus, doChangeSelection) -> { IdeFrameImpl tabFrame = (IdeFrameImpl)info.getObject(); if (tabFrame == myNativeWindow) { TabInfo selectedInfo = getSelectedInfo(); if (selectedInfo != null && selectedInfo.getObject() == myNativeWindow) { return ActionCallback.REJECTED; } return doChangeSelection.run(); } Foundation.executeOnMainThread(true, false, () -> { ID window = MacUtil.getWindowFromJavaWindow((Window)info.getObject()); ID tabGroup = Foundation.invoke(window, "tabGroup"); Foundation.invoke(tabGroup, "setSelectedWindow:", window); }); return ActionCallback.REJECTED; }); }