protected IExtension[] orderExtensions(IExtension[] extensions) {
// By default, the order is based on plugin id sorted
// in ascending order. The order for a plugin providing
// more than one extension for an extension point is
// dependent in the order listed in the XML file.
Sorter sorter = new Sorter() {
public boolean compare(Object extension1, Object extension2) {
String s1 = ((IExtension) extension1).getNamespace().toUpperCase();
String s2 = ((IExtension) extension2).getNamespace().toUpperCase();
//Return true if elementTwo is 'greater than' elementOne
return s2.compareTo(s1) > 0;
}
};
Object[] sorted = sorter.sort(extensions);
IExtension[] sortedExtension = new IExtension[sorted.length];
System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
return sortedExtension;
}