Search in sources :

Example 6 with HelpSet

use of javax.help.HelpSet in project logisim-evolution by reds-heig.

the class MenuHelp method loadBroker.

private void loadBroker() {
    String helpUrl = Strings.get("helpsetUrl");
    if (helpUrl == null) {
        helpUrl = "doc/doc_en.hs";
    }
    if (helpSet == null || helpFrame == null || !helpUrl.equals(helpSetUrl)) {
        ClassLoader loader = MenuHelp.class.getClassLoader();
        try {
            URL hsURL = HelpSet.findHelpSet(loader, helpUrl);
            if (hsURL == null) {
                disableHelp();
                JOptionPane.showMessageDialog(menubar.getParentWindow(), Strings.get("helpNotFoundError"));
                return;
            }
            helpSetUrl = helpUrl;
            helpSet = new HelpSet(null, hsURL);
            helpComponent = new JHelp(helpSet);
            if (helpFrame == null) {
                helpFrame = new LFrame();
                helpFrame.setTitle(Strings.get("helpWindowTitle"));
                helpFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
                helpFrame.getContentPane().add(helpComponent);
                helpFrame.setPreferredSize(new Dimension((int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() >> 1, (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight() >> 1));
                helpFrame.pack();
            } else {
                helpFrame.getContentPane().removeAll();
                helpFrame.getContentPane().add(helpComponent);
                helpComponent.revalidate();
            }
        } catch (Exception e) {
            disableHelp();
            e.printStackTrace();
            JOptionPane.showMessageDialog(menubar.getParentWindow(), Strings.get("helpUnavailableError"));
            return;
        }
    }
}
Also used : HelpSet(javax.help.HelpSet) LFrame(com.cburch.logisim.gui.generic.LFrame) Dimension(java.awt.Dimension) URL(java.net.URL) JHelp(javax.help.JHelp)

Example 7 with HelpSet

use of javax.help.HelpSet in project ffx by mjschnie.

the class MainPanel method help.

/**
 * <p>
 * help</p>
 */
public void help() {
    String helpHS = "ffx/help/jhelpset.hs";
    ClassLoader cl = getClass().getClassLoader();
    HelpSet hs = null;
    try {
        URL hsURL = HelpSet.findHelpSet(cl, helpHS);
        hs = new HelpSet(null, hsURL);
    } catch (Exception e) {
        logger.warning("HelpSet not found: " + e);
        return;
    }
    JHelp jhelp = new JHelp(hs);
    JFrame helpFrame = new JFrame();
    JFrame.setDefaultLookAndFeelDecorated(true);
    helpFrame.add(jhelp);
    helpFrame.setTitle("Force Field X Help");
    helpFrame.setSize(jhelp.getPreferredSize());
    helpFrame.setVisible(true);
    jhelp.setCurrentID("ForceFieldXBook");
    helpFrame.toFront();
}
Also used : HelpSet(javax.help.HelpSet) JFrame(javax.swing.JFrame) ForceFieldString(ffx.potential.parameters.ForceField.ForceFieldString) URL(java.net.URL) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) MalformedURLException(java.net.MalformedURLException) JHelp(javax.help.JHelp)

Example 8 with HelpSet

use of javax.help.HelpSet 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)

Example 9 with HelpSet

use of javax.help.HelpSet in project zaproxy by zaproxy.

the class ExtensionHelp method loadExtensionHelpSet.

private static void loadExtensionHelpSet(Extension ext) {
    URL helpSetUrl = getExtensionHelpSetUrl(ext);
    if (helpSetUrl != null) {
        try {
            logger.debug("Load help files for extension '" + ext.getName() + "' and merge with core help.");
            addHelpSet(ext.getAddOn(), new HelpSet(ext.getClass().getClassLoader(), helpSetUrl));
        } catch (HelpSetException e) {
            logger.error("An error occured while adding help file of extension '" + ext.getName() + "': " + e.getMessage(), e);
        }
    }
}
Also used : HelpSet(javax.help.HelpSet) HelpSetException(javax.help.HelpSetException) URL(java.net.URL)

Example 10 with HelpSet

use of javax.help.HelpSet in project zaproxy by zaproxy.

the class ExtensionHelp method loadAddOnHelpSet.

private static void loadAddOnHelpSet(AddOn addOn) {
    addOn.getLoadedExtensions().forEach(ExtensionHelp::loadExtensionHelpSet);
    AddOn.HelpSetData helpSetData = addOn.getHelpSetData();
    if (helpSetData.isEmpty()) {
        return;
    }
    ClassLoader classLoader = addOn.getClassLoader();
    URL helpSetUrl = LocaleUtils.findResource(helpSetData.getBaseName(), HELP_SET_FILE_EXTENSION, helpSetData.getLocaleToken(), Constant.getLocale(), classLoader::getResource);
    if (helpSetUrl == null) {
        logger.error("Declared helpset not found for '" + addOn.getId() + "' add-on, with base name: " + helpSetData.getBaseName() + (helpSetData.getLocaleToken().isEmpty() ? "" : " and locale token: " + helpSetData.getLocaleToken()));
        return;
    }
    try {
        logger.debug("Loading help for '" + addOn.getId() + "' add-on and merging with core help.");
        addHelpSet(addOn, new HelpSet(classLoader, helpSetUrl));
    } catch (HelpSetException e) {
        logger.error("An error occured while adding help for '" + addOn.getId() + "' add-on:", e);
    }
}
Also used : HelpSet(javax.help.HelpSet) AddOn(org.zaproxy.zap.control.AddOn) HelpSetException(javax.help.HelpSetException) URL(java.net.URL)

Aggregations

HelpSet (javax.help.HelpSet)18 URL (java.net.URL)12 HelpSetException (javax.help.HelpSetException)7 DefaultHelpBroker (javax.help.DefaultHelpBroker)3 HelpBroker (javax.help.HelpBroker)3 Dimension (java.awt.Dimension)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 BadIDException (javax.help.BadIDException)2 CSH (javax.help.CSH)2 JHelp (javax.help.JHelp)2 WindowPresentation (javax.help.WindowPresentation)2 ExecuteAcs (alma.acs.commandcenter.engine.ExecuteAcs)1 ExecuteContainer (alma.acs.commandcenter.engine.ExecuteContainer)1 ExecuteManager (alma.acs.commandcenter.engine.ExecuteManager)1 ExecuteServices (alma.acs.commandcenter.engine.ExecuteServices)1 ExecuteTools (alma.acs.commandcenter.engine.ExecuteTools)1 CommandCenterGui (alma.acs.commandcenter.gui.CommandCenterGui)1 Firestarter (alma.acs.commandcenter.meta.Firestarter)1 OrbInitException (alma.acs.commandcenter.meta.Firestarter.OrbInitException)1