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);
}
Aggregations