void (final int index, boolean requestFocus) { assertIsDispatchThread(); final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder); myTabbedPane.setSelectedIndex(index); if (hadFocus && requestFocus) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myTabbedPaneHolder, true)); } }