@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; } }
String href = topic.getHref(); if (href != null) { int index = id.indexOf('/', 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; } }
@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; }