Search in sources :

Example 11 with HelpSet

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

the class ZapTocView method getDataAsTree.

// Note: The implementation has been copied (verbatim) from the base method except for the use
// of a custom TreeItemFactory.
@Override
public DefaultMutableTreeNode getDataAsTree() {
    HelpSet hs = getHelpSet();
    Hashtable<?, ?> params = getParameters();
    URL url;
    if (params == null || !params.containsKey("data")) {
        return new DefaultMutableTreeNode();
    }
    try {
        url = new URL(hs.getHelpSetURL(), (String) params.get("data"));
    } catch (Exception ex) {
        throw new Error("Trouble getting URL to TOC data; " + ex);
    }
    return parse(url, hs, hs.getLocale(), new TreeItemFactoryImpl(), this);
}
Also used : HelpSet(javax.help.HelpSet) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) URL(java.net.URL) BadIDException(javax.help.BadIDException)

Example 12 with HelpSet

use of javax.help.HelpSet in project intellij-community by JetBrains.

the class HelpManagerImpl method invokeHelp.

public void invokeHelp(@Nullable String id) {
    id = StringUtil.notNullize(id, "top");
    UsageTrigger.trigger("ide.help." + id);
    if (MacHelpUtil.isApplicable() && MacHelpUtil.invokeHelp(id)) {
        return;
    }
    IdeaHelpBroker broker = SoftReference.dereference(myBrokerReference);
    if (broker == null) {
        HelpSet set = createHelpSet();
        if (set != null) {
            broker = new IdeaHelpBroker(set);
            myBrokerReference = new WeakReference<>(broker);
        }
    }
    if (broker == null) {
        ApplicationInfoEx info = ApplicationInfoEx.getInstanceEx();
        String minorVersion = info.getMinorVersion();
        int dot = minorVersion.indexOf('.');
        if (dot != -1) {
            minorVersion = minorVersion.substring(0, dot);
        }
        String productVersion = info.getMajorVersion() + "." + minorVersion;
        String url = info.getWebHelpUrl() + "/" + productVersion + "/?" + id;
        if (PlatformUtils.isJetBrainsProduct()) {
            String productCode = info.getBuild().getProductCode();
            if (!StringUtil.isEmpty(productCode)) {
                url += "&utm_source=from_product&utm_medium=help_link&utm_campaign=" + productCode + "&utm_content=" + productVersion;
            }
        }
        BrowserUtil.browse(url);
        return;
    }
    Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    broker.setActivationWindow(activeWindow);
    try {
        broker.setCurrentID(id);
    } catch (BadIDException e) {
        Messages.showErrorDialog(IdeBundle.message("help.topic.not.found.error", id), CommonBundle.getErrorTitle());
        return;
    }
    broker.setDisplayed(true);
}
Also used : HelpSet(javax.help.HelpSet) ApplicationInfoEx(com.intellij.openapi.application.ex.ApplicationInfoEx) BadIDException(javax.help.BadIDException)

Example 13 with HelpSet

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

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

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

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