/** * Returns an open input stream on the contents of the specified help * resource in the platform's current locale. The client is responsible for * closing the stream when finished. * * @param href * the URL (as a string) of the help resource * <p> * Valid href are as described in * {@link org.eclipse.help.IHelpResource#getHref IHelpResource.getHref} * </p> * @return an input stream containing the contents of the help resource, or * <code>null</code> if the help resource could not be found and * opened */ public static InputStream getHelpContent(String href) { return getHelpContent(href, Platform.getNL()); }
public UAElement resolve(String bundleId, String relativePath, String elementId) throws IOException, SAXException, ParserConfigurationException { String href = '/' + bundleId + '/' + relativePath; try (InputStream in = HelpSystem.getHelpContent(href, locale)) { UAElement element = findElement(in, elementId); processor.process(element, href); return element; } }
private Node[] getContent(String bundleId, String relativePath, String nodeId) throws IOException, SAXException, ParserConfigurationException { String href = '/' + bundleId + '/' + relativePath; try (InputStream in = HelpSystem.getHelpContent(href, locale)) { if (nodeId != null) { Element element = findElement(in, nodeId); processor.process(new UAElement(element), href); return new Node[] { element }; } Element body = findBody(in); List<Node> children = new ArrayList<>(); Node node = body.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { processor.process(new UAElement((Element)node), href); } children.add(node); node = node.getNextSibling(); } return children.toArray(new Node[children.size()]); } }