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;
}
Aggregations