Search in sources :

Example 1 with ShowHelpDialogAction

use of de.alpharogroup.bundle.app.actions.ShowHelpDialogAction in project bundle-app-ui by astrapi69.

the class DesktopMenu method newHelpMenu.

/**
 * Factory method for create new {@link JMenu} for the help menu.
 *
 * @param listener
 *            the listener
 * @return the j menu
 */
private JMenu newHelpMenu(final ActionListener listener) {
    // Help menu
    // $NON-NLS-1$
    final JMenu menuHelp = new JMenu("Help");
    menuHelp.setMnemonic('H');
    // Help JMenuItems
    // Help content
    // $NON-NLS-1$
    final JMenuItem mihHelpContent = new JMenuItem("Content", 'c');
    MenuExtensions.setCtrlAccelerator(mihHelpContent, 'H');
    menuHelp.add(mihHelpContent);
    // found bug with the javax.help
    // Exception in thread "main" java.lang.SecurityException: no manifiest
    // section for signature file entry
    // com/sun/java/help/impl/TagProperties.class
    // Solution is to remove the rsa files from the jar
    final HelpSet hs = getHelpSet();
    final DefaultHelpBroker helpBroker = (DefaultHelpBroker) hs.createHelpBroker();
    final WindowPresentation pres = helpBroker.getWindowPresentation();
    pres.createHelpWindow();
    helpWindow = pres.getHelpWindow();
    helpWindow.setLocationRelativeTo(null);
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (final Exception e1) {
        log.error(e1.getLocalizedMessage(), e1);
    }
    SwingUtilities.updateComponentTreeUI(helpWindow);
    // 2. assign help to components
    CSH.setHelpIDString(mihHelpContent, "Overview");
    // 3. handle events
    final CSH.DisplayHelpFromSource displayHelpFromSource = new CSH.DisplayHelpFromSource(helpBroker);
    mihHelpContent.addActionListener(displayHelpFromSource);
    mihHelpContent.addActionListener(new ShowHelpDialogAction("Content"));
    // Donate
    final JMenuItem mihDonate = new JMenuItem(// $NON-NLS-1$
    Messages.getString("com.find.duplicate.files.menu.item.donate"));
    mihDonate.addActionListener(new OpenBrowserToDonateAction("Donate"));
    menuHelp.add(mihDonate);
    // Licence
    // $NON-NLS-1$
    final JMenuItem mihLicence = new JMenuItem("Licence");
    mihLicence.addActionListener(new ShowLicenseFrameAction("Licence"));
    menuHelp.add(mihLicence);
    // Info
    // $NON-NLS-1$
    final JMenuItem mihInfo = new JMenuItem("Info", 'i');
    MenuExtensions.setCtrlAccelerator(mihInfo, 'I');
    mihInfo.addActionListener(new ShowInfoDialogAction("Info"));
    menuHelp.add(mihInfo);
    return menuHelp;
}
Also used : HelpSet(javax.help.HelpSet) WindowPresentation(javax.help.WindowPresentation) OpenBrowserToDonateAction(de.alpharogroup.bundle.app.actions.OpenBrowserToDonateAction) DefaultHelpBroker(javax.help.DefaultHelpBroker) HelpSetException(javax.help.HelpSetException) ShowHelpDialogAction(de.alpharogroup.bundle.app.actions.ShowHelpDialogAction) ShowInfoDialogAction(de.alpharogroup.bundle.app.actions.ShowInfoDialogAction) ShowLicenseFrameAction(de.alpharogroup.bundle.app.actions.ShowLicenseFrameAction) CSH(javax.help.CSH) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Aggregations

OpenBrowserToDonateAction (de.alpharogroup.bundle.app.actions.OpenBrowserToDonateAction)1 ShowHelpDialogAction (de.alpharogroup.bundle.app.actions.ShowHelpDialogAction)1 ShowInfoDialogAction (de.alpharogroup.bundle.app.actions.ShowInfoDialogAction)1 ShowLicenseFrameAction (de.alpharogroup.bundle.app.actions.ShowLicenseFrameAction)1 CSH (javax.help.CSH)1 DefaultHelpBroker (javax.help.DefaultHelpBroker)1 HelpSet (javax.help.HelpSet)1 HelpSetException (javax.help.HelpSetException)1 WindowPresentation (javax.help.WindowPresentation)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1