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