private Map<String, ITopic> createHref2TopicMap() { Map<String, ITopic> map = new HashMap<>(); if (topic != null) { map.put(topic.getHref(), topic); } ITopic[] topics = getTopics(); for (int i = 0; i < topics.length; ++i) { createHref2TopicMapAux(map, topics[i]); } return map; }
private void createHref2TopicMapAux(Map<String, ITopic> map, ITopic topic) { String href = topic.getHref(); if (href != null) { map.put(href, topic); int anchorIx = href.lastIndexOf("#"); //$NON-NLS-1$ if (anchorIx >= 0) { // anchor exists, drop it and add href again to map String simpleHref = href.substring(0, anchorIx); if (!map.containsKey(simpleHref)) { map.put(simpleHref, topic); } } } ITopic[] subtopics = topic.getSubtopics(); if (subtopics != null) { for (int i = 0; i < subtopics.length; ++i) { if (subtopics[i] != null) { createHref2TopicMapAux(map, subtopics[i]); } } } }
private boolean isNotEmpty(ITopic topic) { String href = topic.getHref(); ITopic[] topics = topic.getSubtopics(); return href != null || isNotEmpty(topics); }
public Topic(ITopic src) { super(NAME, src); setHref(src.getHref()); setLabel(src.getLabel()); appendChildren(src.getChildren()); }
String descriptionHref = tocs[t].getTopic(null).getHref(); if (descriptionHref != null && descriptionHref.length() > 0
public Image getImage(Object obj) { if (obj instanceof IToc) { boolean expanded = treeViewer.getExpandedState(obj); String key = expanded ? IHelpUIConstants.IMAGE_TOC_OPEN : IHelpUIConstants.IMAGE_TOC_CLOSED; return HelpUIResources.getImage(key); } if (obj instanceof ITopic) { boolean expandable = treeViewer.isExpandable(obj); if (expandable) { ITopic topic = (ITopic) obj; if (topic.getHref() != null) return containerWithTopicImage; } String key = expandable ? IHelpUIConstants.IMAGE_CONTAINER : IHelpUIConstants.IMAGE_FILE_F1TOPIC; return HelpUIResources.getImage(key); } return super.getImage(obj); } }
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()); }