public Toc(IToc src) { super(NAME, src); setHref(src.getHref()); setLabel(src.getLabel()); ITopic topic = src.getTopic(null); if (topic != null) { setTopic(topic.getHref()); } appendChildren(src.getChildren()); }
private boolean isNotEmpty(IToc toc) { ITopic[] topics = toc.getTopics(); return isNotEmpty(topics); }
private Map<String, String> createNameIdMap(Map<String, Object> categorized) { Map<String, String> map = new HashMap<>(); for (Iterator<String> iter = categorized.keySet().iterator(); iter.hasNext();) { String key = iter.next(); Object value = categorized.get(key); ITocContribution toc; if (value instanceof TocCategory) { TocCategory category = (TocCategory)value; toc = category.get(0); } else { toc = (ITocContribution)value; } map.put(key, toc.getToc().getLabel()); } return map; }
private IHelpResource getHelpResource() { StringTokenizer tok = new StringTokenizer(path, "_"); //$NON-NLS-1$ int index = Integer.parseInt(tok.nextToken()); IToc[] tocs = HelpSystem.getTocs(); IToc toc = tocs[index]; if (tok.hasMoreTokens()) { ITopic topic = toc.getTopic(null); while (tok.hasMoreTokens()) { index = Integer.parseInt(tok.nextToken()); topic = topic.getSubtopics()[index]; } return topic; } return toc; } }
void doCategoryLink(String href) { parent.showPage(IHelpUIConstants.HV_ALL_TOPICS_PAGE); AllTopicsPart part = (AllTopicsPart) parent .findPart(IHelpUIConstants.HV_TOPIC_TREE); if (part != null) { IToc[] tocs = HelpSystem.getTocs(); IHelpResource target = null; for (int i = 0; i < tocs.length; i++) { if (tocs[i].getHref().equals(href)) target = tocs[i]; } if (target != null) { part.selectReveal(target); } } }
for (int i=0;i<srcContributions.length;++i) { process(srcContributions[i]); IUAElement[] children = srcContributions[i].getToc().getChildren(); for (int j=0;j<children.length;++j) { parent.insertBefore((UAElement)children[j], anchor);
public void selectReveal(String href) { IToc[] tocs = HelpSystem.getTocs(); for (int i = 0; i < tocs.length; i++) { IToc toc = tocs[i]; ITopic topic = toc.getTopic(href); if (topic != null) { selectReveal(topic); return; } } }
@Override public short handle(UAElement element, String id) { if (element instanceof Link) { Link link = (Link)element; UAElement parent = link.getParentElement(); if (parent != null) { String toc = link.getToc(); if (toc != null) { TocContribution destContribution = getContribution(id); TocContribution srcContribution = getContribution(HrefUtil.normalizeHref(destContribution.getContributorId(), toc)); if (srcContribution != null) { process(srcContribution); IUAElement[] children = srcContribution.getToc().getChildren(); for (int i=0;i<children.length;++i) { parent.insertBefore((UAElement)children[i], link); } addExtraDocuments(destContribution, srcContribution.getExtraDocuments()); } parent.removeChild(link); } } return HANDLED_SKIP; } return UNHANDLED; } }
if (hit.getToc()!=null && !Platform.getWS().equals(Platform.WS_GTK)) { buff.append(" alt=\""); //$NON-NLS-1$ buff.append(parent.escapeSpecialChars(hit.getToc().getLabel())); buff.append("\""); //$NON-NLS-1$
public Object[] getChildren(Object parentElement) { if (parentElement == AllTopicsPart.this) return HelpSystem.getTocs(); if (parentElement instanceof IToc) return ((IToc) parentElement).getTopics(); if (parentElement instanceof ITopic) return ((ITopic) parentElement).getSubtopics(); return new Object[0]; }