public EditorTabSelectMenu(
     String label,
     String tooltipKeyNewTab,
     String tooltipKeyTab,
     MainWindow parent,
     boolean includeClipboard) {
   super(label);
   parentWindow = parent;
   newTabTooltip = ResourceMgr.getDescription(tooltipKeyNewTab, true);
   regularTooltip = ResourceMgr.getDescription(tooltipKeyTab, true);
   withClipboard = includeClipboard;
   if (parentWindow != null) {
     parentWindow.addFilenameChangeListener(this);
     parentWindow.addTabChangeListener(this);
   }
 }
  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);
  }
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    productAtEnd = new javax.swing.JCheckBox();
    showProfileGroup = new javax.swing.JCheckBox();
    showWorkspace = new javax.swing.JCheckBox();
    windowTitleLabel = new javax.swing.JLabel();
    windowTitleComboBox = new javax.swing.JComboBox();
    encloseCharLabel = new javax.swing.JLabel();
    encloseChar = new javax.swing.JComboBox();
    jPanel1 = new javax.swing.JPanel();
    titleGroupSepLabel = new javax.swing.JLabel();
    titleGroupSep = new javax.swing.JTextField();
    showUrl = new javax.swing.JCheckBox();
    includeUser = new javax.swing.JCheckBox();

    setLayout(new java.awt.GridBagLayout());

    productAtEnd.setText(ResourceMgr.getString("LblShowProductAtEnd")); // NOI18N
    productAtEnd.setToolTipText(ResourceMgr.getString("d_LblShowProductAtEnd")); // NOI18N
    productAtEnd.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 12, 2, 11);
    add(productAtEnd, gridBagConstraints);

    showProfileGroup.setText(ResourceMgr.getString("LblShowProfileGroup")); // NOI18N
    showProfileGroup.setToolTipText(ResourceMgr.getString("d_LblShowProfileGroup")); // NOI18N
    showProfileGroup.setBorder(null);
    showProfileGroup.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    showProfileGroup.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    showProfileGroup.setIconTextGap(5);
    showProfileGroup.addChangeListener(
        new javax.swing.event.ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent evt) {
            showProfileGroupStateChanged(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(8, 12, 0, 11);
    add(showProfileGroup, gridBagConstraints);

    showWorkspace.setText(ResourceMgr.getString("LblShowWorkspace")); // NOI18N
    showWorkspace.setToolTipText(ResourceMgr.getString("d_LblShowWorkspace")); // NOI18N
    showWorkspace.setBorder(null);
    showWorkspace.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    showWorkspace.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    showWorkspace.setIconTextGap(5);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 12, 0, 1);
    add(showWorkspace, gridBagConstraints);

    windowTitleLabel.setLabelFor(windowTitleComboBox);
    windowTitleLabel.setText(ResourceMgr.getString("LblShowEditorInfo")); // NOI18N
    windowTitleLabel.setToolTipText(ResourceMgr.getString("d_LblShowEditorInfo")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(16, 12, 0, 0);
    add(windowTitleLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(15, 4, 0, 11);
    add(windowTitleComboBox, gridBagConstraints);

    encloseCharLabel.setText(ResourceMgr.getString("LblEncloseGroupChar")); // NOI18N
    encloseCharLabel.setToolTipText(ResourceMgr.getString("d_LblEncloseGroupChar")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 12, 2, 0);
    add(encloseCharLabel, gridBagConstraints);

    encloseChar.setModel(
        new javax.swing.DefaultComboBoxModel(new String[] {"( )", "{ }", "[ ]", "< >"}));
    encloseChar.setToolTipText(ResourceMgr.getDescription("LblEncloseGroupChar"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 11);
    add(encloseChar, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(jPanel1, gridBagConstraints);

    titleGroupSepLabel.setText(ResourceMgr.getString("LblGroupSeparator")); // NOI18N
    titleGroupSepLabel.setToolTipText(ResourceMgr.getString("d_LblGroupSeparator")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 2, 2, 0);
    add(titleGroupSepLabel, gridBagConstraints);

    titleGroupSep.setColumns(5);
    titleGroupSep.setToolTipText(ResourceMgr.getDescription("LblGroupSeparator"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 5, 2, 11);
    add(titleGroupSep, gridBagConstraints);

    showUrl.setText(ResourceMgr.getString("LblUrlInTitle")); // NOI18N
    showUrl.setToolTipText(ResourceMgr.getString("d_LblUrlInTitle")); // NOI18N
    showUrl.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    showUrl.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            showUrlActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 12, 2, 11);
    add(showUrl, gridBagConstraints);

    includeUser.setText(ResourceMgr.getString("LblUrlWithUser")); // NOI18N
    includeUser.setToolTipText(ResourceMgr.getString("d_LblUrlWithUser")); // NOI18N
    includeUser.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 30, 2, 11);
    add(includeUser, gridBagConstraints);
  } // </editor-fold>//GEN-END:initComponents