public final void setSelectedIndex(final int index, boolean requestFocus) {
    assertIsDispatchThread();

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