Search in sources :

Example 1 with HelpBroker

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

the class ExtensionFactory method unloadHelpSet.

private static void unloadHelpSet(Extension ext) {
    HelpBroker hb = ExtensionHelp.getHelpBroker();
    if (hb == null) {
        return;
    }
    URL helpSetUrl = getExtensionHelpSetUrl(ext);
    if (helpSetUrl != null) {
        HelpSet baseHelpSet = hb.getHelpSet();
        Enumeration<?> helpSets = baseHelpSet.getHelpSets();
        while (helpSets.hasMoreElements()) {
            HelpSet extensionHelpSet = (HelpSet) helpSets.nextElement();
            if (helpSetUrl.equals(extensionHelpSet.getHelpSetURL())) {
                baseHelpSet.remove(extensionHelpSet);
                break;
            }
        }
    }
}
Also used : HelpBroker(javax.help.HelpBroker) HelpSet(javax.help.HelpSet) URL(java.net.URL)

Example 2 with HelpBroker

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

the class ExtensionFactory method intitializeHelpSet.

/**
     * If there are help files within the extension, they are loaded and merged
     * with existing help files if the core help was correctly loaded.
     * @param ext the extension being initialised
     */
private static void intitializeHelpSet(Extension ext) {
    HelpBroker hb = ExtensionHelp.getHelpBroker();
    if (hb == null) {
        return;
    }
    URL helpSetUrl = getExtensionHelpSetUrl(ext);
    if (helpSetUrl != null) {
        try {
            log.debug("Load help files for extension '" + ext.getName() + "' and merge with core help.");
            HelpSet extHs = new HelpSet(ext.getClass().getClassLoader(), helpSetUrl);
            hb.getHelpSet().add(extHs);
        } catch (HelpSetException e) {
            log.error("An error occured while adding help file of extension '" + ext.getName() + "': " + e.getMessage(), e);
        }
    }
}
Also used : HelpBroker(javax.help.HelpBroker) HelpSet(javax.help.HelpSet) HelpSetException(javax.help.HelpSetException) URL(java.net.URL)

Aggregations

URL (java.net.URL)2 HelpBroker (javax.help.HelpBroker)2 HelpSet (javax.help.HelpSet)2 HelpSetException (javax.help.HelpSetException)1