public int category(Object element) { if (contentService == null) return 0; INavigatorContentDescriptor source = contentService.getSourceOfContribution(element); if (source == null) source = getSource(element); return source != null ? source.getPriority() : Priority.NORMAL_PRIORITY_VALUE; }
public int compare(Object o1, Object o2) { INavigatorContentDescriptor lvalue = null; INavigatorContentDescriptor rvalue = null; if (o1 instanceof INavigatorContentDescriptor) { lvalue = (INavigatorContentDescriptor) o1; } else if (o1 instanceof INavigatorContentExtension) { lvalue = ((INavigatorContentExtension) o1).getDescriptor(); } if (o2 instanceof INavigatorContentDescriptor) { rvalue = (INavigatorContentDescriptor) o2; } else if (o2 instanceof INavigatorContentExtension) { rvalue = ((INavigatorContentExtension) o2).getDescriptor(); } if (lvalue == null || rvalue == null) { return -1 * sortAscending; } int c = lvalue.getPriority() - rvalue.getPriority(); if (c != 0) { return c * sortAscending; } return lvalue.getId().compareTo(rvalue.getId()) * sortAscending; }