Called when a close tab button is pressed.

@param tabIndex TODO
339081
protected void doClose(int tabIndex) {
        if (tabCloseListener == null || tabCloseListener.tabAboutToBeClosed(tabIndex)) {
            String    title     = tabPane.getTitleAt(tabIndex);
            Component component = tabPane.getComponentAt(tabIndex);

            tabPane.removeTabAt(tabIndex);

            if (tabCloseListener != null) {
                tabCloseListener.tabClosed(title, component);
            }
        }
    }
1066713
void initTabEventHandler(final ToggleButton tabButton) {

        try {
            tabButton.setOnDragDetected(getHandler(MouseEvent.DRAG_DETECTED));
            tabButton.setOnAction(getHandler(ActionEvent.ACTION));

        } catch (final CoreException ce) {
            LOGGER.error("Error while attaching event handler", ce);
        }
    }
1256343
def removeTab(self, index):
        
        curr_index = self.currentIndex()
        items = list(self.items())

        item = items[index]
        item.close()
        if index <= curr_index:
            self._currentIndex -= 1
78747
@Override
	protected void onQueueBrowserEnumerationClose()
	{
	    try
        {
    		CloseBrowserEnumerationQuery query = new CloseBrowserEnumerationQuery();
    		query.setSessionId(session.getId());
    		query.setBrowserId(browser.getId());
    		query.setEnumId(id);
    		transportEndpoint.blockingRequest(query);
        }
	    catch (JMSException e)
        {
            ErrorTools.log(e, log);
        }
	}
615576
def on_tab_close_clicked(self, event, state_m):
        
        [page, state_identifier] = self.find_page_of_state_m(state_m)
        if page:
            self.close_page(state_identifier, delete=False)
100715
def close_client(self, index=None, client=None, force=False):
        """"""
        if not self.tabwidget.count():
            return
        if client is not None:
            index = self.tabwidget.indexOf(client)
            # if index is not found in tabwidget it's because this client was
            # already closed and the call was performed by the exit callback
            if index == -1:
                return
        if index is None and client is None:
            index = self.tabwidget.currentIndex()
        if index is not None:
            client = self.tabwidget.widget(index)

        # Needed to handle a RuntimeError. See issue 5568.
        try:
            # Close client
            client.stop_button_click_handler()
        except RuntimeError:
            pass

        # Disconnect timer needed to update elapsed time
        try:
            client.timer.timeout.disconnect(client.show_time)
        except (RuntimeError, TypeError):
            pass

        # Check if related clients or kernels are opened
        # and eventually ask before closing them
        if not self.mainwindow_close and not force:
            close_all = True
            if self.get_option('ask_before_closing'):
                close = QMessageBox.question(self, self.get_plugin_title(),
                                       _("Do you want to close this console?"),
                                       QMessageBox.Yes | QMessageBox.No)
                if close == QMessageBox.No:
                    return
            if len(self.get_related_clients(client)) > 0:
                close_all = QMessageBox.question(self, self.get_plugin_title(),
                         _("Do you want to close all other consoles connected "
                           "to the same kernel as this one?"),
                           QMessageBox.Yes | QMessageBox.No)

            client.shutdown()
            if close_all == QMessageBox.Yes:
                self.close_related_clients(client)

        # if there aren't related clients we can remove stderr_file
        related_clients = self.get_related_clients(client)
        if len(related_clients) == 0 and osp.exists(client.stderr_file):
            client.remove_stderr_file()

        client.dialog_manager.close_all()
        client.close()

        # Note: client index may have changed after closing related widgets
        self.tabwidget.removeTab(self.tabwidget.indexOf(client))
        self.clients.remove(client)

        # This is needed to prevent that hanged consoles make reference
        # to an index that doesn't exist. See issue 4881
        try:
            self.filenames.pop(index)
        except IndexError:
            pass

        self.update_tabs_text()

        # Create a new client if the console is about to become empty
        if not self.tabwidget.count() and self.create_new_client_if_empty:
            self.create_new_client()

        self.sig_update_plugin_title.emit()
392500
static synchronized void connectionClosed(EnhancedDebugger debugger) {
        getInstance().tabbedPane.setIconAt(
                getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane),
                connectionClosedIcon);
    }
965406
@UiHandler("m_button")
    protected void onClick(ClickEvent event) {

        m_tab.removeParam(m_paramKey);
        m_tab = null;
        removeFromParent();
    }
108735
public void close()
   {
      // stop index merger
      // when calling this method we must not lock this MultiIndex, otherwise
      // a deadlock might occur
      if (merger != null)
      {
         merger.dispose();
         merger = null;
      }
      
      synchronized (this)
      {
         try
         {
            // stop timer
            if (flushTask != null)
            {
               flushTask.cancel();
            }

            // commit / close indexes
            try
            {
               releaseMultiReader();
            }
            catch (IOException e)
            {
               LOG.error("Exception while closing search index.", e);
            }
            if (modeHandler.getMode().equals(IndexerIoMode.READ_WRITE))
            {
               try
               {
                  flush();
               }
               catch (IOException e)
               {
                  LOG.error("Exception while closing search index.", e);
               }
            }
            volatileIndex.close();
            for (int i = 0; i < indexes.size(); i++)
            {
               (indexes.get(i)).close();
            }

            // finally close directory
            try
            {
               indexDir.close();
            }
            catch (IOException e)
            {
               LOG.error("Exception while closing directory.", e);
            }
            modeHandler.removeIndexerIoModeListener(this);
            indexUpdateMonitor.removeIndexUpdateMonitorListener(this);
            this.stopped.set(true);
         }
         finally
         {
            // Remove the hook that will stop the threads if they are still running
            SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
            {
               public Void run()
               {
                  try
                  {
                     Runtime.getRuntime().removeShutdownHook(hook);
                  }
                  catch (IllegalStateException e)
                  {
                     // can't register shutdown hook because
                     // jvm shutdown sequence has already begun,
                     // silently ignore...
                     if (LOG.isTraceEnabled())
                     {
                        LOG.trace("An exception occurred: " + e.getMessage());
                     }
                  }
                  return null;
               }
            });
         }
      }
   }
290165
function tabView_close() {
    var menuitem = new elementslib.Elem(this._controller.menus['view-menu'].menu_tabview);
    this._controller.click(menuitem);
    this.waitForClosed();

    this._tabView = null;
    this._tabViewDoc = this._controller.window.document;
  }
1295296
public Rectangle closeRectFor(final int tabIndex) {
        final Rectangle rect = rects[tabIndex];
        final int x = rect.x + rect.width - CLOSE_ICON_WIDTH - CLOSE_ICON_RIGHT_MARGIN;
        final int y = rect.y + (rect.height - CLOSE_ICON_WIDTH) / 2;
        final int width = CLOSE_ICON_WIDTH;
        return new Rectangle(x, y, width, width);
    }
53945
private void closePopupViews(AbstractOrderedLayout layout) {

        for (Component item : layout) {
            if (item instanceof PopupView) {
                ((PopupView)item).setPopupVisible(false);
            }
        }
    }
451969
@Override
	protected void onQueueBrowserClose()
	{
		super.onQueueBrowserClose();
		
		try
		{
    		CloseBrowserQuery query = new CloseBrowserQuery();
    		query.setSessionId(session.getId());
    		query.setBrowserId(id);
    		transportEndpoint.blockingRequest(query);
		}
        catch (JMSException e)
        {
            ErrorTools.log(e, log);
        }
	}
1280238
public void onRemoveTab(final AjaxRequestTarget target, final int index)
	{
		final int tabSize = getTabs().size();
		// there have to be at least one tab on the ajaxTabbedPanel...
		if ((2 <= tabSize) && (index < tabSize))
		{
			setSelectedTab(index);
			getTabs().remove(index);
			target.add(this);
		}
	}
1247907
public void updateTabTitle (Tab tab) {
		TabButtonTable table = tabsButtonMap.get(tab);
		if (table == null) {
			throwNotBelongingTabException(tab);
		}
		table.button.setText(getTabTitle(tab));
	}
373204
public void onNewTab(final AjaxRequestTarget target, final T tab, final int index)
	{
		if ((index < 0) || (index >= getTabs().size()))
		{
			throw new IndexOutOfBoundsException();
		}
		getTabs().add(index, tab);
		setSelectedTab(index);
		target.add(this);
	}
5650
private void setCurrentTab(final int index)
	{
		if (this.currentTab == index)
		{
			// already current
			return;
		}
		this.currentTab = index;

		final Component component;

		if ((currentTab == -1) || tabs.isEmpty() || !getVisiblityCache().isVisible(currentTab))
		{
			// no tabs or the current tab is not visible
			component = newPanel();
		}
		else
		{
			// show panel from selected tab
			final T tab = tabs.get(currentTab);
			component = tab.getPanel(TAB_PANEL_ID);
			if (component == null)
			{
				throw new WicketRuntimeException("ITab.getPanel() returned null. TabbedPanel ["
					+ getPath() + "] ITab index [" + currentTab + "]");
			}
		}

		if (!component.getId().equals(TAB_PANEL_ID))
		{
			throw new WicketRuntimeException(
				"ITab.getPanel() returned a panel with invalid id [" + component.getId()
					+ "]. You always have to return a panel with id equal to the provided panelId parameter. TabbedPanel ["
					+ getPath() + "] ITab index [" + currentTab + "]");
		}

		addOrReplace(component);
	}