private static synchronized void logStatus(IStatus errorStatus) { HelpPlugin.getDefault().getLog().log(errorStatus); }
/** * Notifies the platform that the content managed by this provider may * have changed since the last time <code>getTocContributions()</code> * was called, and needs to be updated. */ protected void contentChanged() { // will force a reload next time around HelpPlugin.getTocManager().clearCache(); }
/** * Notifies the platform that the content managed by this provider may * have changed since the last time <code>getContentExtensions()</code> * was called, and needs to be updated. */ protected void contentChanged() { // will force a reload next time around HelpPlugin.getContentExtensionManager().clearCache(); } }
/** * Returns an open input stream on the contents of the specified help * resource for the speficied 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> * @param locale the locale code, e.g. en_US * @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 * @since 3.0 */ public static InputStream getHelpContent(String href, String locale) { IHelpProvider provider = HelpPlugin.getDefault().getHelpProvider(); if (provider != null) { return provider.getHelpContent(href, locale); } return null; }
public static File getConfigurationDirectory() { return getDefault().configurationDirectory; }
@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { int index = systemId.lastIndexOf("/"); //$NON-NLS-1$ if (index >= 0) { Bundle helpBundle = HelpPlugin.getDefault().getBundle(); String dtdPath = "dtds/internal" + systemId.substring(index); //$NON-NLS-1$ URL dtdURL = FileLocator.find(helpBundle, new Path(dtdPath), null); if (dtdURL != null) { InputStream stream = dtdURL.openStream(); if (stream != null) { InputSource is = new InputSource(stream); is.setSystemId(systemId); is.setPublicId(publicId); return is; } } } return new InputSource(new StringReader("")); //$NON-NLS-1$ }
private String getLabel(IUAElement element) { if (element instanceof Topic) { Topic topic = (Topic)element; if (topic.getLabel() == null) { ITopic topic2 = HelpPlugin.getTocManager().getTopic(topic.getHref(), locale); if (topic2 != null) { topic.setLabel(topic2.getLabel()); } else { String msg = "Unable to look up label for help keyword index topic \"" + topic.getHref() + "\" with missing \"" + Topic.ATTRIBUTE_LABEL + "\" attribute (topic does not exist in table of contents; using href as label)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ HelpPlugin.logError(msg); topic.setLabel(topic.getHref()); } } return topic.getLabel(); } else if (element instanceof IndexEntry) { return ((IndexEntry)element).getKeyword(); } return null; } }
/** * Notifies the platform that the content managed by this provider may * have changed since the last time <code>getIndexContributions()</code> * was called, and needs to be updated. */ protected void contentChanged() { // will force a reload next time around HelpPlugin.getIndexManager().clearCache(); } }
/** * Computes and returns context information for the given context id * and locale. * * @param contextId the context id, e.g. "org.my.plugin.my_id" * @param locale the locale being requested, e.g. "en_US" * @return the context, or <code>null</code> if none */ public static IContext getContext(String contextId, String locale) { return HelpPlugin.getContextManager().getContext(contextId, locale); }
public static CriterionResource[] toCriterionResource(ICriteria[] criteriaElements) { List<CriterionResource> criteriaList = new ArrayList<>(); outer: for (int i = 0; i < criteriaElements.length; ++i) { String elementName = criteriaElements[i].getName(); String elementValue = criteriaElements[i].getValue(); if (null != elementName && 0 != elementName.length() && null != elementValue && 0 != elementValue.length()) { if (HelpPlugin.getCriteriaManager().isSupportedCriterion(elementName)) { elementName = elementName.toLowerCase(); StringTokenizer tokenizer = new StringTokenizer(elementValue, ","); //$NON-NLS-1$ List<String> values = new ArrayList<>(); while (tokenizer.hasMoreTokens()) { values.add(tokenizer.nextToken().trim()); } for(int j = 0; j < criteriaList.size(); ++j){ CriterionResource criterion = criteriaList.get(j); if(elementName.equals(criterion.getCriterionName())){ criterion.addCriterionValues(values); continue outer; } } CriterionResource criterionResource = new CriterionResource(elementName, values); criteriaList.add(criterionResource); } } } CriterionResource[] criteria = new CriterionResource[criteriaList.size()]; criteriaList.toArray(criteria); return criteria; }
File cachedCopy = null; if (index != -1) { cachedCopy = new File(HelpPlugin.getConfigurationDirectory(), "/DTDs"); //$NON-NLS-1$ cachedCopy.mkdirs(); cachedCopy = new File(cachedCopy, systemId.substring(index));
public static CriteriaManager getCriteriaManager() { if (getDefault().criteriaManager == null) getDefault().criteriaManager = new CriteriaManager(); return getDefault().criteriaManager; }
/** * Returns the keyword index available in the help system. * * @return the keyword index * @since 3.2 */ public static IIndex getIndex() { return HelpPlugin.getIndexManager().getIndex(Platform.getNL()); }
/** * Computes and returns context information for the given context id * for the platform's current locale. * * @param contextId the context id, e.g. "org.my.plugin.my_id" * @return the context, or <code>null</code> if none */ public static IContext getContext(String contextId) { return HelpPlugin.getContextManager().getContext(contextId, Platform.getNL()); }
private void processCriteria(UAElement element, String id) { if(HelpPlugin.getCriteriaManager().isCriteriaEnabled()){ ITocContribution contribution = getContribution(id); String locale = contribution.getLocale(); ICriteria[] criteria = new ICriteria[0]; if (element instanceof Topic) { Topic topic = (Topic) element; criteria = CriteriaProviderRegistry.getInstance().getAllCriteria(topic); } else if (element instanceof Toc) { Toc toc = (Toc) element; criteria = CriteriaProviderRegistry.getInstance().getAllCriteria(toc); } HelpPlugin.getCriteriaManager().addCriteriaValues(criteria, locale); } } }
/** * Returns the list of all integrated tables of contents available. Each * entry corresponds of a different help "book". * * @return an array of TOC's */ public static IToc[] getTocs() { return HelpPlugin.getTocManager().getTocs(Platform.getNL()); }
public static synchronized void logError(String message, Throwable ex, boolean log, boolean openDialog) { if (message == null) message = ""; //$NON-NLS-1$ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex); HelpPlugin.getDefault().getLog().log(errorStatus); if (openDialog) ErrorDialog.openError(null, null, null, errorStatus); }
public static IndexManager getIndexManager() { if (getDefault().indexManager == null) getDefault().indexManager = new IndexManager(); return getDefault().indexManager; }
public Node[] resolveExtension(String path, int type) { if (manager == null) { manager = HelpPlugin.getContentExtensionManager(); } ContentExtension[] extensions = manager.getExtensions(path, type, locale); List<Node> list = new ArrayList<>(); for (int i=0;i<extensions.length;++i) { String content = extensions[i].getContent(); try { Node[] nodes = getContent(content); for (int j=0;j<nodes.length;++j) { list.add(nodes[j]); } } catch (Throwable t) { // ignore invalid extensions } } return list.toArray(new Node[list.size()]); }
public synchronized ITopic getTopic(String href, String locale) { Toc[] tocs = HelpPlugin.getTocManager().getTocs(locale); for (int i=0;i<tocs.length;++i) { ITopic topic = tocs[i].getTopic(href); if (topic != null) { return topic; } } int index = href.indexOf('#'); if (index != -1) { return getTopic(href.substring(0, index), locale); } return null; }