protected final synchronized void updateMenu() { if (parentWindow == null) return; List<String> panels = this.parentWindow.getPanelLabels(); if (CollectionUtil.isEmpty(panels)) return; int count = this.getItemCount(); // Make sure none of the items has an ActionListener attached for (int i = 0; i < count; i++) { JMenuItem item = this.getItem(i); if (item != null && target != null) { item.removeActionListener(target); } } this.removeAll(); int current = this.parentWindow.getCurrentPanelIndex(); JMenuItem show = new WbMenuItem(ResourceMgr.getString("LblShowDataInNewTab")); show.setActionCommand(PANEL_CMD_PREFIX + "-1"); show.setToolTipText(newTabTooltip); show.addActionListener(target == null ? this : target); this.add(show); if (withClipboard) { JMenuItem clipboard = new WbMenuItem(ResourceMgr.getString("MnuTxtStmtClip")); clipboard.setToolTipText(ResourceMgr.getDescription("MnuTxtStmtClip", true)); clipboard.setActionCommand(CMD_CLIPBOARD); clipboard.addActionListener(target); this.add(clipboard); } Font boldFont = show.getFont(); if (boldFont != null) boldFont = boldFont.deriveFont(Font.BOLD); addSeparator(); for (int i = 0; i < panels.size(); i++) { if (panels.get(i) == null) continue; String menuText = panels.get(i); if (i < 9) { menuText += " &" + NumberStringCache.getNumberString(i + 1); } else { menuText += NumberStringCache.getNumberString(i + 1); } JMenuItem item = new WbMenuItem(menuText); item.setActionCommand( EditorTabSelectMenu.PANEL_CMD_PREFIX + NumberStringCache.getNumberString(i)); if (i == current && boldFont != null) { item.setFont(boldFont); } // The tooltip is the same for all items item.setToolTipText(regularTooltip); item.addActionListener(target == null ? this : target); this.add(item); } List<TableIdentifier> tables = DbObjectList.Util.getSelectedTableObjects(objectList); setEnabled(tables.size() > 0); }