public int compare(Object o1, Object o2) { if (o1 == o2) return 0; o1 = TngUtil.unwrap(o1); o2 = TngUtil.unwrap(o2); if (o1 instanceof PluginUIPackagesItemProvider && o2 instanceof MethodPlugin) { return -1; } if (o1 instanceof MethodPlugin && o2 instanceof PluginUIPackagesItemProvider) { return 1; } boolean usePresName = PresentationContext.INSTANCE.isShowPresentationNames(); String s1 = null; String s2 = null; if (usePresName && o1 instanceof DescribableElement) { s1 = ((DescribableElement) o1).getPresentationName(); } else if (o1 instanceof MethodElement) { s1 = ((MethodElement) o1).getName(); } else if (o1 instanceof PluginUIPackagesItemProvider) { s1 = ((PluginUIPackagesItemProvider) o1).getFullName(); } else if (o1 instanceof String) { s1 = (String) o1; } if (usePresName && o2 instanceof DescribableElement) { s2 = ((DescribableElement) o2).getPresentationName(); } else if (o2 instanceof MethodElement) { s2 = ((MethodElement) o2).getName(); } else if (o2 instanceof PluginUIPackagesItemProvider) { s2 = ((PluginUIPackagesItemProvider) o2).getFullName(); } else if (o2 instanceof String) { s2 = (String) o2; } if (s1 == null || s2 == null) { return 0; } return s1.compareToIgnoreCase(s2); }
/* (non-Javadoc) * @see org.eclipse.epf.library.edit.util.Comparators.TypeComparator#getDefaultComparator() */ protected Comparator getDefaultComparator() { return PresentationContext.INSTANCE.getPresNameComparator(); }