Search in sources :

Example 1 with HelpSetException

use of javax.help.HelpSetException 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 2 with HelpSetException

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

Example 3 with HelpSetException

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

Example 4 with HelpSetException

use of javax.help.HelpSetException in project ACS by ACS-Community.

the class CommandCenterLogic method prepare.

//
// ============ Startup / Shutdown ====================
//
public void prepare(StartupOptions startupOptions) {
    this.startupOptions = startupOptions;
    log = MiscUtils.getPackageLogger(this);
    // Make up the creator string for command center projects.
    projectCreatorId = (version().equals("")) ? null : "acc-" + version();
    projectMaker = new ProjectMaker(projectCreatorId);
    project = projectMaker.createProject();
    model = new MyProjectRunModel(project);
    executeServices = new ExecuteServices(model);
    executeManager = new ExecuteManager(model);
    executeContainer = new ExecuteContainer();
    executeAcs = new ExecuteAcs(model);
    executeTools = new ExecuteTools(model);
    firestarter = new Firestarter("AcsCommandCenter", log, null);
    // msc (2007-11): needed for talking to daemons
    Executor.remoteDaemonEnable(firestarter);
    deploymentTreeControllerImpl = new DeploymentTreeControllerImpl();
    gui = new CommandCenterGui(this);
    gui.prepare();
    // --- read the built-in tools
    try {
        URL url = findResource(ToolManager.getDefaultBuiltinToolsName(), "");
        loadBuiltinTools(url);
    } catch (Exception exc) {
        log.severe("*** FATAL: Could not read definition of built-in tools." + " Printing stacktrace to stderr and exiting. ***");
        exc.printStackTrace(System.err);
        exit(4);
    }
    // --- read the extra tools
    try {
        URL url = findResource(ToolManager.getDefaultExtraToolsName(), "");
        installExtraTools(url);
    } catch (Exception exc) {
        log.info("Failed to read " + ToolManager.getDefaultExtraToolsName() + "; reason was: " + exc);
    }
    try {
        ClassLoader cl = null;
        URL url = findResource(HELPSET_NAME, "");
        this.helpSet = new HelpSet(cl, url);
    } catch (HelpSetException ex) {
        log.info("couldn't read helpset, no help available");
    }
}
Also used : HelpSet(javax.help.HelpSet) ExecuteServices(alma.acs.commandcenter.engine.ExecuteServices) ExecuteTools(alma.acs.commandcenter.engine.ExecuteTools) ExecuteAcs(alma.acs.commandcenter.engine.ExecuteAcs) CommandCenterGui(alma.acs.commandcenter.gui.CommandCenterGui) URL(java.net.URL) ValidationException(org.exolab.castor.xml.ValidationException) HelpSetException(javax.help.HelpSetException) MarshalException(org.exolab.castor.xml.MarshalException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) OrbInitException(alma.acs.commandcenter.meta.Firestarter.OrbInitException) ExecuteContainer(alma.acs.commandcenter.engine.ExecuteContainer) HelpSetException(javax.help.HelpSetException) Firestarter(alma.acs.commandcenter.meta.Firestarter) ExecuteManager(alma.acs.commandcenter.engine.ExecuteManager)

Example 5 with HelpSetException

use of javax.help.HelpSetException in project bundle-app-ui by astrapi69.

the class DesktopMenu method getHelpSet.

/**
 * Gets the help set.
 *
 * @return the help set
 */
public HelpSet getHelpSet() {
    HelpSet hs = null;
    final String filename = "simple-hs.xml";
    final String directoryPath = "help/";
    try {
        hs = JComponentFactory.newHelpSet(directoryPath, filename);
    } catch (final HelpSetException e) {
        log.error("Instanciation problem of class HelpSet.", e);
    }
    return hs;
}
Also used : HelpSet(javax.help.HelpSet) HelpSetException(javax.help.HelpSetException)

Aggregations

HelpSet (javax.help.HelpSet)5 HelpSetException (javax.help.HelpSetException)5 URL (java.net.URL)4 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 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HelpBroker (javax.help.HelpBroker)1 MarshalException (org.exolab.castor.xml.MarshalException)1 ValidationException (org.exolab.castor.xml.ValidationException)1 AddOn (org.zaproxy.zap.control.AddOn)1