Search in sources :

Example 1 with BadIDException

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

Aggregations

ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)1 BadIDException (javax.help.BadIDException)1 HelpSet (javax.help.HelpSet)1