Example usage for javax.swing JMenuItem JMenuItem

List of usage examples for javax.swing JMenuItem JMenuItem

Introduction

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

Prototype

public JMenuItem(Action a) 

Source Link

Document

Creates a menu item whose properties are taken from the specified Action.

Usage

From source file:edu.synth.SynthHelper.java

private void menu() {
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);/*  w  ww.j  ava2  s  .c  o m*/

    mnFile = new JMenu("File");
    menuBar.add(mnFile);

    mntmOpenWorkspace = new JMenuItem("Open Workspace...");
    mntmOpenWorkspace.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    clear();
                    String path = SyntHelper.getInstance().openDialogFileChooser(state.getWorkspacePath(), true,
                            "Choose Workspace", "Choose", null);
                    try {
                        state.setWorkspacePath(path);
                    } catch (IOException e) {
                        Messager.publish("Set Workspace", e);
                    }
                    initSettings();
                    setValues();
                }
            }).start();
        }
    });
    mnFile.add(mntmOpenWorkspace);

    mntmApplyChanges = new JMenuItem("Save Changes...");
    mntmApplyChanges.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        state.saveSettings();
                    } catch (IOException e) {
                        Messager.publish("Save Settings Files", e);
                    }
                }
            }).start();
        }
    });
    mnFile.add(mntmApplyChanges);

    mntmExportConfFiles = new JMenuItem("Export Settings Files to Workspace...");
    mntmExportConfFiles.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        state.saveSettings();
                    } catch (IOException e) {
                        Messager.publish("Save Settings Files", e);
                    }
                    if (!state.getWorkspacePath().isEmpty())
                        try {
                            state.copySettingsFilesToWorkspace();
                        } catch (IOException e) {
                            Messager.publish("Export Settings Files to Workspace", e);
                        }
                    else
                        Messager.publish("Export Settings Files to Workspace",
                                "Files have not been copied. Workspace has not been selected!");
                }
            }).start();
        }
    });
    mnFile.add(mntmExportConfFiles);

    mnFile.add(new JSeparator());
    mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            System.exit(0);
        }
    });
    mnFile.add(mntmExit);

    mnOperations = new JMenu("Operations");
    menuBar.add(mnOperations);

    mntmViewObs = new JMenuItem("View Observed Data (1.obs)");
    mntmViewObs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        new DataViewWindow("Observed Data Viewer", new File(Constants.OBS_DATA));
                    } catch (IOException e) {
                        Messager.publish("Observed Data Viewer error", e);
                    }
                }
            }).start();
        }
    });
    mnOperations.add(mntmViewObs);

    mnOperations.add(new JSeparator());

    mntmRunSynth = new JMenuItem("Run Synth");
    mntmRunSynth.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            new Thread(new ExecuteSynthConvThread()).start();
        }
    });
    mnOperations.add(mntmRunSynth);

    mntmRunSynthForObs = new JMenuItem("Run Synth for Observed Data");
    mntmRunSynthForObs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            final Thread main = new Thread(new ExecuteSynthConvDivThread());
            main.start();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    while (main.isAlive()) {
                    }
                    ;
                    try {
                        new SyntHelperChartWindow("Result of synthesis and dividing");
                    } catch (IOException e) {
                        Messager.publish("Charting result error", e);
                    }
                }
            }).start();
        }
    });
    mnOperations.add(mntmRunSynthForObs);

    mnHelp = new JMenu("Help");
    menuBar.add(mnHelp);

    mntmLogWindow = new JMenuItem("Log Window");
    mntmLogWindow.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            LogPublisher.getInstance().openWindow();
        }
    });
    mnHelp.add(mntmLogWindow);

    mnHelp.add(new JSeparator());

    mntmAbout = new JMenuItem("About SYNTHelper");
    mnHelp.add(mntmAbout);

    mntmHelp = new JMenuItem("Help Content");
    mnHelp.add(mntmHelp);
}

From source file:de.hstsoft.sdeep.view.MainWindow.java

private void createUI() {
    mapView = new MapView();
    getContentPane().add(mapView, BorderLayout.CENTER);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);//from   w w  w  .  j av a  2s. c o  m

    JMenu mnFile = new JMenu("File");
    menuBar.add(mnFile);

    JMenuItem mntmOpenSaveGame = new JMenuItem("Open Savegame");
    mntmOpenSaveGame.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            openFileChooser();
        }
    });
    mnFile.add(mntmOpenSaveGame);

    mnFile.addSeparator();

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    mnFile.add(mntmExit);

    JMenu mnView = new JMenu("View");
    menuBar.add(mnView);

    final JCheckBoxMenuItem menuItemShowinfo = new JCheckBoxMenuItem("ShowInfo");
    menuItemShowinfo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean showInfo = menuItemShowinfo.isSelected();
            mapView.setShowInfo(showInfo);
        }
    });
    menuItemShowinfo.setSelected(mapView.isShowInfo());
    mnView.add(menuItemShowinfo);

    final JCheckBoxMenuItem menuItemShowgrid = new JCheckBoxMenuItem("ShowGrid");
    menuItemShowgrid.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean showGrid = menuItemShowgrid.isSelected();
            mapView.setShowGrid(showGrid);
        }
    });
    menuItemShowgrid.setSelected(mapView.isShowGrid());
    mnView.add(menuItemShowgrid);

    final JCheckBoxMenuItem menuItemNotes = new JCheckBoxMenuItem("ShowNotes");
    menuItemNotes.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean showNotes = menuItemNotes.isSelected();
            mapView.setShowNotes(showNotes);
        }
    });
    menuItemNotes.setSelected(mapView.isShowNotes());
    mnView.add(menuItemNotes);

    final JCheckBoxMenuItem menuItemAnimals = new JCheckBoxMenuItem("ShowAnimals");
    menuItemAnimals.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean showAnimals = menuItemAnimals.isSelected();
            mapView.setShowAnimals(showAnimals);
        }
    });
    menuItemAnimals.setSelected(mapView.isShowAnimals());
    mnView.add(menuItemAnimals);

    mnView.addSeparator();

    menuItemFileWatcher = new JCheckBoxMenuItem("Auto refresh");
    menuItemFileWatcher.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean enabled = menuItemFileWatcher.isSelected();
            toggleAutoRefresh(enabled);
        }
    });
    mnView.add(menuItemFileWatcher);

    mnView.addSeparator();

    JMenuItem menuItemResetView = new JMenuItem("Reset view");
    menuItemResetView.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            mapView.resetView();
        }
    });
    mnView.add(menuItemResetView);

    JMenu mnInfo = new JMenu("Info");
    menuBar.add(mnInfo);

    JMenuItem mntmInfo = new JMenuItem("About");
    mntmInfo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showInfo();
        }
    });
    mnInfo.add(mntmInfo);

}

From source file:be.agiv.security.demo.Main.java

private void addMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);//from ww  w .  j  av  a  2  s .  c om

    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    this.preferencesMenuItem = new JMenuItem("Preferences");
    fileMenu.add(this.preferencesMenuItem);
    this.preferencesMenuItem.addActionListener(this);
    fileMenu.addSeparator();
    this.exitMenuItem = new JMenuItem("Exit");
    fileMenu.add(this.exitMenuItem);
    this.exitMenuItem.addActionListener(this);

    JMenu ipStsMenu = new JMenu("IP-STS");
    menuBar.add(ipStsMenu);
    this.ipStsIssueMenuItem = new JMenuItem("Issue token");
    ipStsMenu.add(this.ipStsIssueMenuItem);
    this.ipStsIssueMenuItem.addActionListener(this);
    this.ipStsViewMenuItem = new JMenuItem("View token");
    ipStsMenu.add(this.ipStsViewMenuItem);
    this.ipStsViewMenuItem.addActionListener(this);
    this.ipStsViewMenuItem.setEnabled(false);

    JMenu rStsMenu = new JMenu("R-STS");
    menuBar.add(rStsMenu);
    this.rStsIssueMenuItem = new JMenuItem("Issue token");
    rStsMenu.add(this.rStsIssueMenuItem);
    this.rStsIssueMenuItem.addActionListener(this);
    this.rStsIssueMenuItem.setEnabled(false);
    this.rStsViewMenuItem = new JMenuItem("View token");
    rStsMenu.add(this.rStsViewMenuItem);
    this.rStsViewMenuItem.addActionListener(this);
    this.rStsViewMenuItem.setEnabled(false);

    JMenu secConvMenu = new JMenu("Secure Conversation");
    menuBar.add(secConvMenu);
    this.secConvIssueMenuItem = new JMenuItem("Issue token");
    secConvMenu.add(this.secConvIssueMenuItem);
    this.secConvIssueMenuItem.addActionListener(this);
    this.secConvIssueMenuItem.setEnabled(false);
    this.secConvViewMenuItem = new JMenuItem("View token");
    secConvMenu.add(this.secConvViewMenuItem);
    this.secConvViewMenuItem.addActionListener(this);
    this.secConvViewMenuItem.setEnabled(false);
    this.secConvCancelMenuItem = new JMenuItem("Cancel token");
    secConvMenu.add(this.secConvCancelMenuItem);
    this.secConvCancelMenuItem.addActionListener(this);
    this.secConvCancelMenuItem.setEnabled(false);

    JMenu servicesMenu = new JMenu("Services");
    menuBar.add(servicesMenu);
    this.claimsAwareServiceMenuItem = new JMenuItem("Claims aware service");
    servicesMenu.add(this.claimsAwareServiceMenuItem);
    this.claimsAwareServiceMenuItem.addActionListener(this);

    menuBar.add(Box.createHorizontalGlue());
    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    this.aboutMenuItem = new JMenuItem("About");
    helpMenu.add(this.aboutMenuItem);
    this.aboutMenuItem.addActionListener(this);
}

From source file:jhplot.HPlotChart.java

/**
 * Create canvas that keeps JFreeChart panel. 
 * //from   w  ww.  j  a v a2 s  .  c  om
 * @param jchart 
 *           chart of JFreeChart. 
 * @param xsize
 *            size in x direction
 * @param ysize
 *            size in y direction
 */

public HPlotChart(JFreeChart jchart, int xsize, int ysize) {

    this.xsize = xsize;
    this.ysize = ysize;
    frame = new JFrame("HPloatChart");

    chart = jchart;
    cp = new ChartPanel(chart);
    cp.setPreferredSize(new Dimension(xsize, ysize));
    cp.setBackground(DEFAULT_BG_COLOR);
    cp.setLayout(new BorderLayout());
    cp.setDomainZoomable(true);
    cp.setRangeZoomable(true);

    chart.setAntiAlias(true);
    chart.setBorderPaint(DEFAULT_BG_COLOR);
    chart.setBackgroundPaint(DEFAULT_BG_COLOR);
    chart.setBorderVisible(false);

    org.jfree.chart.plot.Plot pp = (org.jfree.chart.plot.Plot) chart.getPlot();
    pp.setBackgroundPaint(DEFAULT_BG_COLOR);

    setTheme("LEGACY_THEME");
    frame.add(cp);

    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    JMenuItem item1 = new JMenuItem("Export");
    item1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            exportDialog();
        }
    });

    JMenuItem item2 = new JMenuItem("Close");
    item2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            close();
        }
    });

    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    menu.add(item1);
    menu.add(item2);

    bar.add(menu);
    frame.setJMenuBar(bar);
    frame.setPreferredSize(new Dimension(xsize, ysize));

}

From source file:org.cds06.speleograph.graph.SeriesMenu.java

private JPopupMenu createPopupMenuForSeries(final Series series) {

    if (series == null)
        return new JPopupMenu();

    final JPopupMenu menu = new JPopupMenu(series.getName());

    menu.removeAll();//from  www .  j  a v  a2s. com

    menu.add(new AbstractAction() {
        {
            putValue(NAME, "Renommer la srie");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            menu.setVisible(false);
            String newName = "";
            while (newName == null || newName.equals("")) {
                newName = (String) JOptionPane.showInputDialog(application,
                        "Entrez un nouveau nom pour la srie", null, JOptionPane.QUESTION_MESSAGE, null, null,
                        series.getName());
            }
            series.setName(newName);
        }
    });

    if (series.hasOwnAxis()) {
        menu.add(new AbstractAction() {

            {
                putValue(NAME, "Supprimer l'axe spcifique");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application, "tes vous sr de vouloir supprimer cet axe ?",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                    series.setAxis(null);
                }
            }
        });
    } else {
        menu.add(new JMenuItem(new AbstractAction() {

            {
                putValue(NAME, "Crer un axe spcifique pour la srie");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                String name = JOptionPane.showInputDialog(application, "Quel titre pour cet axe ?",
                        series.getAxis().getLabel());
                if (name == null || "".equals(name))
                    return; // User has canceled
                series.setAxis(new NumberAxis(name));
            }
        }));
    }

    menu.add(new SetTypeMenu(series));

    if (series.isWater()) {
        menu.addSeparator();
        menu.add(new SumOnPeriodAction(series));
        menu.add(new CreateCumulAction(series));
    }
    if (series.isWaterCumul()) {
        menu.addSeparator();
        menu.add(new SamplingAction(series));
    }

    if (series.isPressure()) {
        menu.addSeparator();
        menu.add(new CorrelateAction(series));
        menu.add(new WaterHeightAction(series));
    }

    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canUndo())
                name = "Annuler " + series.getItemsName();
            else
                name = series.getLastUndoName();

            putValue(NAME, name);

            if (series.canUndo())
                setEnabled(true);
            else {
                setEnabled(false);
            }

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.undo();
        }
    });

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canRedo()) {
                name = "Refaire " + series.getNextRedoName();
                setEnabled(true);
            } else {
                name = series.getNextRedoName();
                setEnabled(false);
            }

            putValue(NAME, name);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.redo();
        }
    });

    menu.add(new AbstractAction() {
        {
            putValue(NAME, I18nSupport.translate("menus.serie.resetSerie"));
            if (series.canUndo())
                setEnabled(true);
            else
                setEnabled(false);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.reset();
        }
    });

    menu.add(new LimitDateRangeAction(series));

    menu.add(new HourSettingAction(series));

    menu.addSeparator();

    {
        JMenuItem deleteItem = new JMenuItem("Supprimer la srie");
        deleteItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application,
                        "tes-vous sur de vouloir supprimer cette srie ?\n"
                                + "Cette action est dfinitive.",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                    series.delete();
                }
            }
        });
        menu.add(deleteItem);
    }

    menu.addSeparator();

    {
        final JMenuItem up = new JMenuItem("Remonter dans la liste"),
                down = new JMenuItem("Descendre dans la liste");
        ActionListener listener = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (e.getSource().equals(up)) {
                    series.upSeriesInList();
                } else {
                    series.downSeriesInList();
                }
            }
        };
        up.addActionListener(listener);
        down.addActionListener(listener);
        if (series.isFirst()) {
            menu.add(down);
        } else if (series.isLast()) {
            menu.add(up);
        } else {
            menu.add(up);
            menu.add(down);
        }
    }

    menu.addSeparator();

    {
        menu.add(new SeriesInfoAction(series));
    }

    {
        JMenuItem colorItem = new JMenuItem("Couleur de la srie");
        colorItem.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                series.setColor(JColorChooser.showDialog(application,
                        I18nSupport.translate("actions.selectColorForSeries"), series.getColor()));
            }
        });
        menu.add(colorItem);
    }

    {
        JMenu plotRenderer = new JMenu("Affichage de la srie");
        final ButtonGroup modes = new ButtonGroup();
        java.util.List<DrawStyle> availableStyles;
        if (series.isMinMax()) {
            availableStyles = DrawStyles.getDrawableStylesForHighLow();
        } else {
            availableStyles = DrawStyles.getDrawableStyles();
        }
        for (final DrawStyle s : availableStyles) {
            final JRadioButtonMenuItem item = new JRadioButtonMenuItem(DrawStyles.getHumanCheckboxText(s));
            item.addChangeListener(new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    if (item.isSelected())
                        series.setStyle(s);
                }
            });
            modes.add(item);
            if (s.equals(series.getStyle())) {
                modes.setSelected(item.getModel(), true);
            }
            plotRenderer.add(item);
        }
        menu.add(plotRenderer);
    }
    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            putValue(Action.NAME, "Fermer le fichier");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (JOptionPane.showConfirmDialog(application,
                    "tes-vous sur de vouloir fermer toutes les sries du fichier ?", "Confirmation",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                final File f = series.getOrigin();
                for (final Series s : Series.getInstances().toArray(new Series[Series.getInstances().size()])) {
                    if (s.getOrigin().equals(f))
                        s.delete();
                }
            }
        }
    });

    return menu;
}

From source file:SiteFrame.java

public PageFrame(String name, SiteManager sm) {
    super("Page: " + name, true, true, true, true);
    parent = sm;/*w  ww.  ja  v a  2 s . c  o m*/
    setBounds(50, 50, 300, 150);

    Container contentPane = getContentPane();

    // Create a text area to display the contents of our file in
    // and stick it in a scrollable pane so we can see everything
    ta = new JTextArea();
    JScrollPane jsp = new JScrollPane(ta);
    contentPane.add(jsp, BorderLayout.CENTER);

    JMenuBar jmb = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem saveItem = new JMenuItem("Save");
    saveItem.addActionListener(this);
    fileMenu.add(saveItem);
    jmb.add(fileMenu);
    setJMenuBar(jmb);

    filename = name;
    loadContent();
}

From source file:edu.clemson.cs.nestbed.client.gui.MessageMonitorFrame.java

private JMenu buildFileMenu() {
    JMenu menu = new JMenu("File");
    JMenuItem close = new JMenuItem("Close");

    close.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            MessageMonitorFrame.this.setVisible(false);
        }/*from w w w  .j  a v  a 2  s  .c om*/
    });
    menu.add(close);

    return menu;
}

From source file:ch.algotrader.client.chart.ChartTab.java

private void initPopupMenu() {

    this.getPopupMenu().addSeparator();

    JMenuItem resetMenuItem = new JMenuItem("Reset Chart");
    resetMenuItem.addActionListener(new ActionListener() {
        @Override//from ww w  .j av  a  2s . com
        public void actionPerformed(ActionEvent e) {
            ChartTab.this.chartPlugin.setInitialized(false);
            ChartTab.this.chartPlugin.newSwingWorker().execute();
        }
    });
    this.getPopupMenu().add(resetMenuItem);

    JMenuItem updateMenuItem = new JMenuItem("Update Chart Data");
    updateMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ChartTab.this.chartPlugin.newSwingWorker().execute();
        }
    });
    this.getPopupMenu().add(updateMenuItem);

    this.getPopupMenu().addSeparator();
}

From source file:io.github.jeddict.relation.mapper.widget.table.RelationTableWidget.java

@Override
protected List<JMenuItem> getPopupMenuItemList() {
    List<JMenuItem> menuList = super.getPopupMenuItemList();
    DBRelationTable relationTable = this.getBaseElementSpec();
    if (relationTable.getAttribute() instanceof JoinColumnHandler) {
        JMenuItem joinTable = new JMenuItem("Delete Join Table");
        joinTable.addActionListener((ActionEvent e) -> {
            convertToJoinColumn();/*from   www.j a  v a2  s .  c  om*/
            ModelerFile parentFile = RelationTableWidget.this.getModelerScene().getModelerFile()
                    .getParentFile();
            DBUtil.openDBModeler(parentFile);
            JeddictLogger.recordDBAction("Delete Join Table");
        });
        menuList.add(0, joinTable);
    }
    return menuList;
}

From source file:gdt.jgui.entity.procedure.JProcedurePanel.java

/**
 * Get the context menu.//from   w w  w  .  j a  v  a2 s .  c o m
 * @return the context menu.
 */
@Override
public JMenu getContextMenu() {
    menu = new JMenu("Context");
    menu.addMenuListener(new MenuListener() {
        @Override
        public void menuSelected(MenuEvent e) {
            menu.removeAll();
            JMenuItem runItem = new JMenuItem("Run");
            runItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    run();
                }
            });
            menu.add(runItem);
            Entigrator entigrator = console.getEntigrator(entihome$);
            Sack procedure = entigrator.getEntityAtKey(entityKey$);
            if (procedure.getElementItem("parameter", "noreset") == null) {
                JMenuItem resetItem = new JMenuItem("Reset");
                resetItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(),
                                "Reset source to default ?", "Confirm", JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION)
                            reset();
                    }
                });
                menu.add(resetItem);
            }
            JMenuItem folderItem = new JMenuItem("Open folder");
            folderItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        File file = new File(entihome$ + "/" + entityKey$);
                        Desktop.getDesktop().open(file);
                    } catch (Exception ee) {
                        Logger.getLogger(getClass().getName()).info(ee.toString());
                    }
                }
            });
            menu.add(folderItem);
            try {
                //Entigrator entigrator=console.getEntigrator(entihome$);
                Sack entity = entigrator.getEntityAtKey(entityKey$);
                String template$ = entity.getAttributeAt("template");
                if (template$ != null) {
                    JMenuItem adaptClone = new JMenuItem("Adapt clone");
                    adaptClone.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            try {
                                adaptClone(console, getLocator());
                            } catch (Exception ee) {
                                Logger.getLogger(getClass().getName()).info(ee.toString());
                            }
                        }
                    });
                    menu.add(adaptClone);
                }
            } catch (Exception ee) {
                Logger.getLogger(getClass().getName()).info(ee.toString());
            }
        }

        @Override
        public void menuDeselected(MenuEvent e) {
        }

        @Override
        public void menuCanceled(MenuEvent e) {
        }
    });
    return menu;
}