@Override public short handle(UAElement element, String id) { if (element instanceof Topic) { Topic topic = (Topic)element; String href = topic.getHref(); if (href != null) { int index = id.indexOf('/', 1); if (index != -1) { String pluginId = id.substring(1, index); topic.setHref(HrefUtil.normalizeHref(pluginId, href)); } } String title = element.getAttribute("title"); //$NON-NLS-1$ if (title != null) { topic.setLabel(title); } } return UNHANDLED; } }
if (index != -1) { String pluginId = id.substring(1, index); topic.setHref(HrefUtil.normalizeHref(pluginId, href));
public Topic(ITopic src) { super(NAME, src); setHref(src.getHref()); setLabel(src.getLabel()); appendChildren(src.getChildren()); }
@Override public short handle(UAElement element, String id) { if (element instanceof Topic) { Topic topic = (Topic)element; String href = topic.getHref(); if (href != null) { topic.setHref(normalize(href, id)); } processCriteria(element, id); return HANDLED_CONTINUE; } else if (element instanceof Toc) { Toc toc = (Toc)element; toc.setHref(id); String topic = toc.getTopic(); if (topic != null) { toc.setTopic(normalize(topic, id)); } processCriteria(element, id); return HANDLED_CONTINUE; } return UNHANDLED; }
public void mergeContext(IContext src) { String text = src.getText(); if (getText() == null || getText().length() == 0) { setText(text); } if (src instanceof IContext2 && getTitle() == null) { String title = ((IContext2)src).getTitle(); if (title != null) { setAttribute(ATTRIBUTE_TITLE, title); } } if (src instanceof IContext3) { ICommandLink[] commands = ((IContext3)src).getRelatedCommands(); for (int i=0;i<commands.length;++i) { appendChild(new CommandLink(commands[i])); } } IHelpResource[] topics = src.getRelatedTopics(); for (int i=0;i<topics.length;++i) { if (topics[i] instanceof ITopic) { appendChild(new Topic((ITopic)topics[i])); } else { Topic topic = new Topic(); topic.setHref(topics[i].getHref()); topic.setLabel(topics[i].getLabel()); appendChild(topic); } } }