Java Code Examples for javax.help.HelpSet#getHelpSetURL()

The following examples show how to use javax.help.HelpSet#getHelpSetURL() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelpModuleCollection.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, TOCItemExternal> getTOCItemExternalsByDisplayMapping() {
	Map<String, TOCItemExternal> map = new HashMap<>();

	if (externalHelpSets.isEmpty()) {
		return map;
	}

	for (HelpSet helpSet : externalHelpSets) {
		TOCView view = (TOCView) helpSet.getNavigatorView("TOC");
		DefaultMutableTreeNode node = view.getDataAsTree();
		URL url = helpSet.getHelpSetURL();
		try {
			URL dataURL = new URL(url, (String) view.getParameters().get("data"));
			Path path = Paths.get(dataURL.toURI());
			addPrebuiltItem(node, path, map);
		}
		catch (MalformedURLException | URISyntaxException e) {
			throw new RuntimeException("Internal error", e);
		}
	}
	return map;
}
 
Example 2
Source File: CheckHelpSets.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void processMapRef(HelpSet hs, @SuppressWarnings("rawtypes") Hashtable attrs) {
    try {
        URL map = new URL(hs.getHelpSetURL(), (String)attrs.get("location"));
        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(false);
        SAXParser parser = factory.newSAXParser();
        parser.parse(new InputSource(map.toExternalForm()), new Handler(map.getFile()));
    } catch (Exception e) {
        e.printStackTrace();
    }
}