Search in sources :

Example 1 with AboutAction

use of apps.AboutAction in project JMRI by JMRI.

the class HelpUtil method makeHelpMenu.

public static JMenu makeHelpMenu(String ref, boolean direct) {
    if (!initOK()) {
        log.warn("help initialization not completed");
        // initialization failed
        return null;
    }
    JMenu helpMenu = new JMenu(Bundle.getMessage("HELP"));
    JMenuItem item = makeHelpMenuItem(ref);
    if (item == null) {
        log.error("Can't make help menu item for " + ref);
        return null;
    }
    helpMenu.add(item);
    if (direct) {
        item = new JMenuItem(Bundle.getMessage("MenuItemHelp"));
        globalHelpBroker.enableHelpOnButton(item, "index", null);
        helpMenu.add(item);
        // add standard items
        JMenuItem license = new JMenuItem(Bundle.getMessage("MenuItemLicense"));
        helpMenu.add(license);
        license.addActionListener(new apps.LicenseAction());
        JMenuItem directories = new JMenuItem(Bundle.getMessage("MenuItemLocations"));
        helpMenu.add(directories);
        directories.addActionListener(new jmri.jmrit.XmlFileLocationAction());
        JMenuItem updates = new JMenuItem(Bundle.getMessage("MenuItemCheckUpdates"));
        helpMenu.add(updates);
        updates.addActionListener(new apps.CheckForUpdateAction());
        JMenuItem context = new JMenuItem(Bundle.getMessage("MenuItemContext"));
        helpMenu.add(context);
        context.addActionListener(new apps.ReportContextAction());
        JMenuItem console = new JMenuItem(Bundle.getMessage("MenuItemConsole"));
        helpMenu.add(console);
        console.addActionListener(new apps.SystemConsoleAction());
        helpMenu.add(new jmri.jmrit.mailreport.ReportAction());
        // Put about dialog in Apple's prefered area on Mac OS X
        if (SystemType.isMacOSX()) {
            try {
                Application.getApplication().setAboutHandler((EventObject eo) -> {
                    new AboutDialog(null, true).setVisible(true);
                });
            } catch (java.lang.RuntimeException re) {
                log.error("Unable to put About handler in default location", re);
            }
        }
        // Include About in Help menu if not on Mac OS X or not using Aqua Look and Feel
        if (!SystemType.isMacOSX() || !UIManager.getLookAndFeel().isNativeLookAndFeel()) {
            helpMenu.addSeparator();
            JMenuItem about = new JMenuItem(Bundle.getMessage("MenuItemAbout") + " " + jmri.Application.getApplicationName());
            helpMenu.add(about);
            about.addActionListener(new AboutAction());
        }
    }
    return helpMenu;
}
Also used : AboutDialog(jmri.swing.AboutDialog) AboutAction(apps.AboutAction) EventObject(java.util.EventObject) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Aggregations

AboutAction (apps.AboutAction)1 EventObject (java.util.EventObject)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 AboutDialog (jmri.swing.AboutDialog)1