Example usage for javax.swing JPopupMenu add

List of usage examples for javax.swing JPopupMenu add

Introduction

In this page you can find the example usage for javax.swing JPopupMenu add.

Prototype

public JMenuItem add(Action a) 

Source Link

Document

Appends a new menu item to the end of the menu which dispatches the specified Action object.

Usage

From source file:com.AandR.beans.plotting.LinePlotPanel.LinePlotPanel.java

private ChartPanel createChartPanel() {
    JFreeChart xyChart = ChartFactory.createXYLineChart("f", "x", "y", plotSeries, PlotOrientation.VERTICAL,
            false, true, false);/*from www .j  a  v a 2  s.c  o m*/
    RenderingHints hints = xyChart.getRenderingHints();
    hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    xyChart.setBackgroundPaint(Color.WHITE);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyChart.getXYPlot().getRenderer();
    renderer.setBaseLinesVisible(isLineVisible);
    renderer.setBaseShapesVisible(isSymbolVisible);

    LegendTitle legend = new LegendTitle(renderer);
    legend.setPosition(RectangleEdge.BOTTOM);
    xyChart.addLegend(legend);

    xyChart.getXYPlot().getRangeAxis().setStandardTickUnits(createTickUnits());
    //xyChart.getXYPlot().getRangeAxis().setStandardTickUnits(new StandardTickUnitSource());
    xyChart.getXYPlot().getRangeAxis().setAutoRangeMinimumSize(1.0e-45);

    chartPanel = new ChartPanel(xyChart);

    JPopupMenu popup = chartPanel.getPopupMenu();
    popup.remove(1); // removes separator
    popup.remove(1); // removes save as...
    popup.add(createLinePropMenu());
    popup.add(createAxesPropMenu());
    popup.addSeparator();
    popup.add(createExportMenu());
    return chartPanel;
}

From source file:gdt.jgui.entity.webset.JWeblinkEditor.java

private void showLoginMenu(MouseEvent e) {
    try {/*  ww  w  .  jav a  2s . com*/
        JPopupMenu logonMenu = new JPopupMenu();
        JMenuItem copyItem = new JMenuItem("Copy");
        logonMenu.add(copyItem);
        copyItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        copyItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    StringSelection stringSelection = new StringSelection(loginField.getText());
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    clipboard.setContents(stringSelection, JWeblinkEditor.this);
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        logonMenu.show(e.getComponent(), e.getX(), e.getY());
    } catch (Exception ee) {
        Logger.getLogger(getClass().getName()).severe(ee.toString());
    }
}

From source file:es.emergya.ui.gis.FleetControlMapViewer.java

@Override
protected JPopupMenu getContextMenu() {
    JPopupMenu menu = new JPopupMenu();

    menu.setBackground(Color.decode("#E8EDF6"));

    // Ttulo/*www  .  j a  va 2 s. c  om*/
    final JMenuItem titulo = new JMenuItem(i18n.getString("map.menu.titulo.puntoGenerico"));
    titulo.setFont(LogicConstants.deriveBoldFont(10.0f));
    titulo.setBackground(Color.decode("#A4A4A4"));
    titulo.setFocusable(false);

    menu.add(titulo);

    menu.addSeparator();

    // Actualizar posicin
    final JMenuItem gps = new JMenuItem(i18n.getString("map.menu.gps"), KeyEvent.VK_P);
    gps.setIcon(LogicConstants.getIcon("menucontextual_icon_actualizargps"));
    menu.add(gps);
    gps.addActionListener(this);
    gps.setEnabled(false);

    menu.addSeparator();

    // Mostrar ms cercanos
    final JMenuItem mmc = new JMenuItem(i18n.getString("map.menu.showNearest"), KeyEvent.VK_M);
    mmc.setIcon(LogicConstants.getIcon("menucontextual_icon_mascercano"));
    mmc.addActionListener(this);
    menu.add(mmc);
    // Centrar aqui
    final JMenuItem cent = new JMenuItem(i18n.getString("map.menu.centerHere"), KeyEvent.VK_C);
    cent.setIcon(LogicConstants.getIcon("menucontextual_icon_centrar"));
    cent.addActionListener(this);
    menu.add(cent);
    // Nueva Incidencia
    final JMenuItem newIncidence = new JMenuItem(i18n.getString("map.menu.newIncidence"), KeyEvent.VK_I);
    newIncidence.setIcon(LogicConstants.getIcon("menucontextual_icon_newIncidence"));
    newIncidence.addActionListener(this);
    menu.add(newIncidence);
    // Calcular ruta desde aqui
    final JMenuItem from = new JMenuItem(i18n.getString("map.menu.route.from"), KeyEvent.VK_D);
    from.setIcon(LogicConstants.getIcon("menucontextual_icon_origenruta"));
    from.addActionListener(this);
    menu.add(from);
    // Calcular ruta hasta aqui
    final JMenuItem to = new JMenuItem(i18n.getString("map.menu.route.to"), KeyEvent.VK_H);
    to.setIcon(LogicConstants.getIcon("menucontextual_icon_destinoruta"));
    to.addActionListener(this);
    menu.add(to);

    menu.addSeparator();

    // Ver ficha [recurso / incidencia]
    final JMenuItem summary = new JMenuItem(i18n.getString("map.menu.summary"), KeyEvent.VK_F);
    summary.setIcon(LogicConstants.getIcon("menucontextual_icon_ficha"));
    summary.addActionListener(this);
    menu.add(summary);
    summary.setEnabled(false);

    menu.addPopupMenuListener(new PopupMenuListener() {

        @SuppressWarnings("unchecked")
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            eventOriginal = FleetControlMapViewer.this.mapView.lastMEvent;
            gps.setEnabled(false);
            summary.setEnabled(false);
            titulo.setText(i18n.getString("map.menu.titulo.puntoGenerico"));
            menuObjective = null;
            Point p = new Point(mapView.lastMEvent.getX(), mapView.lastMEvent.getY());
            for (Layer l : mapView.getAllLayers()) { // por cada capa...
                if (l instanceof MarkerLayer) { // ...de marcadores
                    for (Marker marker : ((MarkerLayer) l).data) { // miramos
                        // los
                        // marcadores
                        if ((marker instanceof CustomMarker) && marker.containsPoint(p)) { // y si
                            // estamos
                            // pinchando
                            // en uno
                            CustomMarker m = (CustomMarker) marker;
                            log.trace("Hemos pinchado en " + marker);

                            switch (m.getType()) {
                            case RESOURCE:
                                Recurso r = (Recurso) m.getObject();
                                log.trace("Es un recurso: " + r);
                                if (r != null) {
                                    menuObjective = r;
                                    if (r.getPatrullas() != null) {
                                        titulo.setText(
                                                i18n.getString(Locale.ROOT, "map.menu.titulo.recursoPatrulla",
                                                        r.getIdentificador(), r.getPatrullas()));
                                    } else {
                                        titulo.setText(r.getIdentificador());
                                    }
                                    gps.setEnabled(true);
                                    summary.setEnabled(true);
                                }
                                break;
                            case INCIDENCE:
                                Incidencia i = (Incidencia) m.getObject();
                                log.trace("Es una incidencia: " + i);
                                if (i != null) {
                                    menuObjective = i;
                                    titulo.setText(i.getTitulo());
                                    gps.setEnabled(false);
                                    summary.setEnabled(true);
                                }
                                break;
                            case UNKNOWN:
                                log.trace("Hemos pinchado en un marcador desconocido");
                                break;
                            }

                        }
                    }
                }
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
        }
    });

    return menu;
}

From source file:coolmap.application.widget.impl.WidgetUserGroup.java

private void initPopup() {
    JPopupMenu popup = new JPopupMenu();
    table.setComponentPopupMenu(popup);/*  w w w.  ja  va  2s  .com*/

    JMenuItem item = new JMenuItem("Rename");
    popup.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            List<String> groupNames = getSelectedGroups();
            if (groupNames.isEmpty()) {
                return;
            }

            String returnVal = JOptionPane.showInputDialog(CoolMapMaster.getCMainFrame(),
                    "Please provide a new name:");
            if (returnVal == null || returnVal.length() == 0) {
                returnVal = "Untitled";
            }

            int counter = 0;
            String newName;
            for (String groupName : groupNames) {
                if (counter == 0) {
                    newName = returnVal;
                } else {
                    newName = returnVal + "_" + counter;
                }

                //new name must not exist
                int subCounter = 0;
                String name = newName;
                while (nodeGroups.containsKey(name)) {
                    subCounter++;
                    name = newName + "_" + subCounter;
                }
                newName = name;

                Color c = nodeColor.get(groupName);
                Set<VNode> nodes = new HashSet(nodeGroups.get(groupName));

                nodeColor.remove(groupName);
                nodeGroups.removeAll(groupName);

                nodeColor.put(newName, c);
                nodeGroups.putAll(newName, nodes);

                //                    System.out.println(newName + " " + c + " " + nodes);
                counter++;
            }

            updateTable();

        }
    });
    ////////////////////////////////////////////////////////////////////////

    //remove operations
    item = new JMenuItem("Remove");
    popup.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            List<String> groupNames = getSelectedGroups();
            for (String group : groupNames) {
                nodeColor.remove(group);
                nodeGroups.removeAll(group);
            }
            updateTable();
        }
    });

    //add separarator
    popup.addSeparator();
    JMenu insertRow = new JMenu("Add selected to row");
    popup.add(insertRow);

    JMenu insertColumn = new JMenu("Add selected to column");
    popup.add(insertColumn);

    item = new JMenuItem("prepend", UI.getImageIcon("prependRow"));
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            insertRow(0);
        }
    });

    item = new JMenuItem("prepend", UI.getImageIcon("prependColumn"));
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            insertColumn(0);
        }
    });

    item = new JMenuItem("insert", UI.getImageIcon("insertRow"));
    item.setToolTipText("Insert selected groups to the selected region in the active coolmap view");
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            CoolMapObject obj = CoolMapMaster.getActiveCoolMapObject();
            if (obj == null) {
                return;
            }

            int index = 0;
            ArrayList selectedRows = obj.getCoolMapView().getSelectedRows();
            if (!selectedRows.isEmpty()) {
                index = ((Range<Integer>) selectedRows.iterator().next()).lowerEndpoint();
            }
            insertRow(index);
        }
    });

    item = new JMenuItem("insert", UI.getImageIcon("insertColumn"));
    item.setToolTipText("Insert selected groups to the selected region in the active coolmap view");
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            CoolMapObject obj = CoolMapMaster.getActiveCoolMapObject();
            if (obj == null) {
                return;
            }

            int index = 0;
            ArrayList selectedColumns = obj.getCoolMapView().getSelectedColumns();
            if (!selectedColumns.isEmpty()) {
                index = ((Range<Integer>) selectedColumns.iterator().next()).lowerEndpoint();
            }
            insertColumn(index);
        }
    });

    item = new JMenuItem("append", UI.getImageIcon("appendRow"));
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (CoolMapMaster.getActiveCoolMapObject() == null) {
                return;
            }
            insertRow(CoolMapMaster.getActiveCoolMapObject().getViewNumRows());
        }
    });

    item = new JMenuItem("append", UI.getImageIcon("appendColumn"));
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (CoolMapMaster.getActiveCoolMapObject() == null) {
                return;
            }
            insertColumn(CoolMapMaster.getActiveCoolMapObject().getViewNumColumns());
        }
    });

    item = new JMenuItem("replace", UI.getImageIcon("replaceRow"));
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            replaceRow();
        }
    });

    item = new JMenuItem("replace", UI.getImageIcon("replaceColumn"));
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            replaceColumn();
        }
    });
}

From source file:com.clank.launcher.dialog.LauncherFrame.java

/**
 * Popup the menu for the instances./*ww w  .  j a  v  a 2 s  .  c  o m*/
 *
 * @param component the component
 * @param x mouse X
 * @param y mouse Y
 * @param selected the selected instance, possibly null
 */
private void popupInstanceMenu(Component component, int x, int y, final Instance selected) {
    JPopupMenu popup = new JPopupMenu();
    JMenuItem menuItem;

    if (selected != null) {
        menuItem = new JMenuItem(!selected.isLocal() ? "Install" : "Launch");
        menuItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                launch();
            }
        });
        popup.add(menuItem);

        if (selected.isLocal()) {
            popup.addSeparator();

            menuItem = new JMenuItem(_("instance.openFolder"));
            menuItem.addActionListener(
                    ActionListeners.browseDir(LauncherFrame.this, selected.getContentDir(), true));
            popup.add(menuItem);

            menuItem = new JMenuItem(_("instance.openSaves"));
            menuItem.addActionListener(ActionListeners.browseDir(LauncherFrame.this,
                    new File(selected.getContentDir(), "saves"), true));
            popup.add(menuItem);

            menuItem = new JMenuItem(_("instance.openResourcePacks"));
            menuItem.addActionListener(ActionListeners.browseDir(LauncherFrame.this,
                    new File(selected.getContentDir(), "resourcepacks"), true));
            popup.add(menuItem);

            menuItem = new JMenuItem(_("instance.openScreenshots"));
            menuItem.addActionListener(ActionListeners.browseDir(LauncherFrame.this,
                    new File(selected.getContentDir(), "screenshots"), true));
            popup.add(menuItem);

            menuItem = new JMenuItem(_("instance.copyAsPath"));
            menuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    File dir = selected.getContentDir();
                    dir.mkdirs();
                    SwingHelper.setClipboard(dir.getAbsolutePath());
                }
            });
            popup.add(menuItem);

            popup.addSeparator();

            if (!selected.isUpdatePending()) {
                menuItem = new JMenuItem(_("instance.forceUpdate"));
                menuItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        selected.setUpdatePending(true);
                        launch();
                        instancesModel.update();
                    }
                });
                popup.add(menuItem);
            }

            menuItem = new JMenuItem(_("instance.hardForceUpdate"));
            menuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    confirmHardUpdate(selected);
                }
            });
            popup.add(menuItem);

            menuItem = new JMenuItem(_("instance.deleteFiles"));
            menuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    confirmDelete(selected);
                }
            });
            popup.add(menuItem);
        }

        popup.addSeparator();
    }

    menuItem = new JMenuItem(_("launcher.refreshList"));
    menuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadInstances();
        }
    });
    popup.add(menuItem);

    popup.show(component, x, y);

}

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Build the popup menu to switch between typeAnimation.
 * works only when statistic has observations 
 * Called by MouseListener   //from   w w  w  . j a  va  2  s  . c o m
 * Event wird nur bearbeitet, wenn die Simulation angehalten ist
 * Im anderen Fall kann der Viewer (inbes. Applet) ueberlastet sein
 * @param event      MouseEvent
 */
private void checkPopupMenu(MouseEvent event) {
    //System.out.println("StatisticGrafic.checkPopupMenu");
    ViewerPanel viewer = this.statistic.getModel().getViewer();
    if (viewer != null && viewer.getSimulationThread() != null && !viewer.getSimulationThread().isWorking()) {
        // Event wird nur bearbeitet, wenn die Simulation angehalten ist
        // Im anderen Fall kann der Viewer (inbes. Applet) ueberlastet sein
        if (event.isPopupTrigger() && this.statistic.hasValue()) {
            JPopupMenu popup = new JPopupMenu();
            JMenuItem mi = new JMenuItem(StatisticGrafic.TEXT_POPUP_MENU[0]);
            mi.addActionListener(this);
            popup.add(mi);
            mi = new JMenuItem(StatisticGrafic.TEXT_POPUP_MENU[1]);
            mi.addActionListener(this);
            popup.add(mi);
            popup.show(event.getComponent(), event.getX(), event.getY());
        }
    }
}

From source file:de.ailis.xadrian.components.ComplexEditor.java

/**
 * Constructor//from  w  w w. j ava 2 s .c  o  m
 *
 * @param complex
 *            The complex to edit
 * @param file
 *            The file from which the complex was loaded. Null if it not
 *            loaded from a file.
 */
public ComplexEditor(final Complex complex, final File file) {
    super();
    setLayout(new BorderLayout());

    this.complex = complex;
    this.file = file;

    // Create the text pane
    this.textPane = new JTextPane();
    this.textPane.setEditable(false);
    this.textPane.setBorder(null);
    this.textPane.setContentType("text/html");
    this.textPane.setDoubleBuffered(true);
    this.textPane.addHyperlinkListener(this);
    this.textPane.addCaretListener(this);

    // Create the popup menu for the text pane
    final JPopupMenu popupMenu = new JPopupMenu();
    popupMenu.add(new CopyAction(this));
    popupMenu.add(new SelectAllAction(this));
    popupMenu.addSeparator();
    popupMenu.add(new AddFactoryAction(this));
    popupMenu.add(new ChangeSectorAction(this.complex, this, "complex"));
    popupMenu.add(new ChangeSunsAction(this));
    popupMenu.add(new ChangePricesAction(this));
    popupMenu.add(new JCheckBoxMenuItem(new ToggleBaseComplexAction(this)));
    SwingUtils.setPopupMenu(this.textPane, popupMenu);

    final HTMLDocument document = (HTMLDocument) this.textPane.getDocument();

    // Set the base URL of the text pane
    document.setBase(Main.class.getResource("templates/"));

    // Modify the body style so it matches the system font
    final Font font = UIManager.getFont("Label.font");
    final String bodyRule = "body { font-family: " + font.getFamily() + "; font-size: " + font.getSize()
            + "pt; }";
    document.getStyleSheet().addRule(bodyRule);

    // Create the scroll pane
    final JScrollPane scrollPane = new JScrollPane(this.textPane);
    add(scrollPane);

    // Redraw the content
    redraw();

    fireComplexState();
}

From source file:gdt.jgui.entity.webset.JWeblinkEditor.java

private void showPasswordMenu(MouseEvent e) {
    try {/*from   w  w  w .j  a  v a  2s  .co  m*/
        JPopupMenu passwordMenu = new JPopupMenu();
        JMenuItem copyItem = new JMenuItem("Copy");
        passwordMenu.add(copyItem);
        copyItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        copyItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    StringSelection stringSelection = new StringSelection(passwordField.getText());
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    clipboard.setContents(stringSelection, JWeblinkEditor.this);
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        JMenuItem encodeItem = new JMenuItem("Encrypt/decrypt");
        passwordMenu.add(encodeItem);
        encodeItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        encodeItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    save();
                    JTextEncrypter te = new JTextEncrypter();
                    String teLocator$ = te.getLocator();
                    teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                    teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, passwordField.getText());
                    teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT_TITLE, nameField.getText());
                    String weLocator$ = JWeblinkEditor.this.getLocator();
                    weLocator$ = Locator.append(weLocator$, BaseHandler.HANDLER_METHOD, "response");
                    weLocator$ = Locator.append(weLocator$, JRequester.REQUESTER_ACTION,
                            ACTION_ENCODE_PASSWORD);
                    teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(weLocator$));
                    JConsoleHandler.execute(console, teLocator$);
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        passwordMenu.show(e.getComponent(), e.getX(), e.getY());
    } catch (Exception ee) {
        Logger.getLogger(getClass().getName()).severe(ee.toString());
    }
}

From source file:jmupen.MyListSelectionListener.java

@Override
public void mousePressed(MouseEvent e) {
    list.setSelectedIndex(list.locationToIndex(e.getPoint()));
    int index = list.getSelectedIndex();
    if (SwingUtilities.isRightMouseButton(e)) {
        JPopupMenu menu = new JPopupMenu();
        JMenuItem item = new JMenuItem("Remove");
        item.addActionListener(new ActionListener() {
            @Override/*  ww  w .j ava2  s.  c om*/
            public void actionPerformed(ActionEvent e) {
                if (index != -1) {
                    try {
                        System.out.println("Linea: " + index + " " + model.get(index));
                        model.removeElementAt(index);
                        removeLines(index, JMupenUtils.getRecents().toFile());
                        JMupenUtils.setGames(JMupenUtils.getGamesFromFile(JMupenUtils.getRecents()));
                    } catch (IOException ex) {
                        System.err.println("Error removing recent game. " + ex.getLocalizedMessage());
                    }
                }
            }
        });
        menu.add(item);
        menu.show(list, e.getX(), e.getY());
    }
}

From source file:com.quattroresearch.antibody.plugin.PluginLoader.java

/**
 * Loads the plugins that are offered in a domains context menu.
 * /*from   w w w .ja  va  2  s .  c o  m*/
 * @param popup
 * @param domain
 */
public void loadDomainPopupPlugins(JPopupMenu popup, Domain domain) {
    String popupConfig = PreferencesService.getInstance().getApplicationPrefs()
            .getString("plugins.popup.domain");
    if (popupConfig == null) {
        return;
    }
    String[] popupPlugins = popupConfig.split(";");
    try {
        for (String singleConfig : popupPlugins) {

            Class<?> clazz = classLoader.findClass(singleConfig);

            if (clazz != null) {
                Constructor<?> constructor;

                constructor = clazz.getDeclaredConstructor(JFrame.class, Domain.class);

                JMenuItem item = (JMenuItem) constructor.newInstance(UIService.getInstance().getMainFrame(),
                        domain);

                popup.add(item);

            }

        }
    } catch (ClassNotFoundException exc) {
        System.err.println("Toolbar Plugin class was not found: " + exc.toString());
    } catch (Exception exc) {
        System.err.println(exc.toString());
    }
}