public synchronized Toc getToc(String id, String locale) { getTocs(locale); return tocsById.get(id); }
/** * 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 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; }
public synchronized int[] getTopicPath(String href, String locale) { ITopic topic = getTopic(href, locale); try { if (topic != null && topic instanceof UAElement) { List<Integer> path = new ArrayList<>(); UAElement element = (UAElement) topic; while (!(element instanceof Toc)) { UAElement parent = element.getParentElement(); path.add(Integer.valueOf(indexOf(parent, (Topic)element))); element = parent; } Toc[] tocs = getTocs(locale); for (int i=0;i<tocs.length;++i) { if (tocs[i] == element) { path.add(Integer.valueOf(i)); int[] array = new int[path.size()]; for (int j=0;j<array.length;++j) { array[j] = path.get(array.length - 1 - j).intValue(); } return array; } } } } catch (Exception e) { return null; } // no path; not in toc return null; }
public synchronized ICriteriaDefinition getCriteriaDefinition(String locale) { CriteriaDefinition criteriaDefinition = criteriaDefinitionsByLocale.get(locale); if (null == criteriaDefinition) { HelpPlugin.getTocManager().getTocs(locale); long start = System.currentTimeMillis(); if (HelpPlugin.DEBUG_CRITERIA) { System.out.println("Start to update criteria definition for locale " + locale); //$NON-NLS-1$ } List<CriteriaDefinitionContribution> contributions = new ArrayList<>( Arrays.asList(readCriteriaDefinitionContributions(locale))); CriteriaDefinitionAssembler assembler = new CriteriaDefinitionAssembler(); criteriaDefinition = assembler.assemble(contributions); criteriaDefinitionsByLocale.put(locale, criteriaDefinition); long stop = System.currentTimeMillis(); if (HelpPlugin.DEBUG_CRITERIA) { System.out.println("Milliseconds to update criteria definition for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$ } } return criteriaDefinition; }
public synchronized Toc getOwningToc(String href) { if (tocsByTopic == null) { tocsByTopic = new HashMap<>(); Toc[] tocs = HelpPlugin.getTocManager().getTocs(Platform.getNL()); for (int i=0;i<tocs.length;++i) { ITocContribution contribution = tocs[i].getTocContribution(); String[] extraDocuments = contribution.getExtraDocuments(); for (int j=0;j<extraDocuments.length;++j) { tocsByTopic.put(extraDocuments[j], tocs[i]); } } } return tocsByTopic.get(href); }
public synchronized IIndex getIndex(String locale) { Index index = indexesByLocale.get(locale); if (index == null) { HelpPlugin.getTocManager().getTocs(locale); // Ensure Tocs and index not built simultaneously long start = System.currentTimeMillis(); if (HelpPlugin.DEBUG_INDEX) { System.out.println("Start to update keyword index for locale " + locale); //$NON-NLS-1$ } List<IndexContribution> contributions = new ArrayList<>(Arrays.asList(readIndexContributions(locale))); filterIndexContributions(contributions); IndexAssembler assembler = new IndexAssembler(); index = assembler.assemble(contributions, locale); indexesByLocale.put(locale, index); long stop = System.currentTimeMillis(); if (HelpPlugin.DEBUG_INDEX) { System.out.println("Milliseconds to update keyword index for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$ } } return index; }
private String getTopicCategory(String href, String locale) { IToc[] tocs = HelpPlugin.getTocManager().getTocs(locale); for (int i = 0; i < tocs.length; i++) { ITopic topic = tocs[i].getTopic(href); if (topic != null) return tocs[i].getLabel(); } return null; }
Toc[] tocs = HelpPlugin.getTocManager().getTocs(locale); for (int t = 0; t < tocs.length; t++) { String descriptionHref = tocs[t].getTopic(null).getHref();