* Returns the string that will be displayed for the given object,
* used for sorting.
*/
private static String getLabel(UAElement element) {
if (element instanceof Topic) {
Topic topic = (Topic)element;
if (topic.getLabel() == null) {
ITopic topic2 = HelpPlugin.getTocManager().getTopic(topic.getHref());
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;