1 11 package org.eclipse.pde.internal.ui.wizards; 12 13 import org.eclipse.jface.viewers.Viewer; 14 import org.eclipse.jface.viewers.ViewerSorter; 15 16 public class WizardCollectionSorter extends ViewerSorter { 17 private String baseCategory; 18 19 public WizardCollectionSorter(String baseCategory) { 20 this.baseCategory = baseCategory; 21 } 22 public int compare(Viewer viewer, Object o1, Object o2) { 23 String name2 = ((WizardCollectionElement) o2).getLabel(); 24 String name1 = ((WizardCollectionElement) o1).getLabel(); 25 if (name2.equals(name1)) 26 return 0; 27 28 if (baseCategory != null) { 29 if (name2.equalsIgnoreCase(baseCategory)) 32 return -1; 33 34 if (name1.equalsIgnoreCase(baseCategory)) 35 return 1; 36 } 37 38 return name2.compareTo(name1); 39 } 40 public boolean isSorterProperty(Object object,Object propertyId) { 41 return true; 42 } 43 } 44 | Popular Tags |