How do I add an action to the global popup menu of tabs?
While there is no official way to add a custom action to a foreign TopComponent’s tab, you can achieve this by installing a hook into the Swing event dispatch thread and listening for the popup activation. Then when the popup is detected, copy the actions from the TopComponent, add your custom actions, and finally set a new popup menu for that particular TopComponent. // Install hook into the AWT event dispatch thread so we can capture context popup private void addGlobalContextAction() { Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent event) { MouseEvent mouseEvent = (MouseEvent) event; if (mouseEvent.isPopupTrigger()) { if (mouseEvent.getSource() instanceof TabDisplayer) { // Find the TopComponent being wrapped TabDisplayer tabDisplayer = (TabDisplayer) mouseEvent.getSource(); TabData tabData = tabDisplayer.getModel().getTab( tabDisplayer.getSelectionModel().getSelectedIndex()); TopComponent tc = (TopComponent) tabData.get