public final synchronized void removeTabAt(final int index) {
    assertIsDispatchThread();

    final boolean hadFocus = IJSwingUtilities.hasFocus2(tabbedPaneHolder);
    final TabWrapper wrapper = getWrapperAt(index);
    try {
      tabbedPane.removeTabAt(index);
      if (tabbedPane.getTabCount() == 0) {
        // to clear BasicTabbedPaneUI.visibleComponent field
        tabbedPane.revalidate();
      }
      if (hadFocus) {
        IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() ->
                                                                     IdeFocusManager.getGlobalInstance()
                                                                       .requestFocus(tabbedPaneHolder, true));
      }
    }
    finally {
      wrapper.dispose();
    }
  }
public final synchronized void removeTabAt(final int index)