Search in sources :

Example 1 with MZmineModuleCategory

use of net.sf.mzmine.modules.MZmineModuleCategory in project mzmine2 by mzmine.

the class MainMenu method addMenuItemForModule.

public void addMenuItemForModule(MZmineRunnableModule module) {
    MZmineModuleCategory parentMenu = module.getModuleCategory();
    String menuItemText = module.getName();
    String menuItemToolTip = module.getDescription();
    JMenuItem newItem = new JMenuItem(menuItemText);
    newItem.setToolTipText(menuItemToolTip);
    newItem.addActionListener(this);
    /*
     * Shortcuts keys to open, save and close a project. Implementation will be changed with JavaFX.
     */
    if (menuItemText == "Open project") {
        newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
    }
    if (menuItemText == "Save project") {
        newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    }
    if (menuItemText == "Close project") {
        newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK));
    }
    moduleMenuItems.put(newItem, module);
    addMenuItem(parentMenu, newItem);
}
Also used : MZmineModuleCategory(net.sf.mzmine.modules.MZmineModuleCategory) JMenuItem(javax.swing.JMenuItem)

Aggregations

JMenuItem (javax.swing.JMenuItem)1 MZmineModuleCategory (net.sf.mzmine.modules.MZmineModuleCategory)1