1 11 12 package org.eclipse.ui.internal.dialogs; 13 14 import org.eclipse.jface.viewers.IBasicPropertyConstants; 15 import org.eclipse.jface.viewers.ViewerSorter; 16 import org.eclipse.ui.internal.registry.WizardsRegistryReader; 17 18 27 class NewWizardCollectionSorter extends ViewerSorter { 28 31 public final static NewWizardCollectionSorter INSTANCE = new NewWizardCollectionSorter(); 32 33 34 39 private NewWizardCollectionSorter() { 40 super(); 41 } 42 43 47 public int category(Object element) { 48 if (element instanceof WorkbenchWizardElement) { 49 return -1; 50 } 51 if (element instanceof WizardCollectionElement){ 52 String id = ((WizardCollectionElement)element).getId(); 53 if (WizardsRegistryReader.GENERAL_WIZARD_CATEGORY.equals(id)) { 54 return 1; 55 } 56 if (WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY.equals(id)) { 57 return 3; 58 } 59 if (WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY.equals(id)) { 60 return 4; 61 } 62 return 2; 63 } 64 return super.category(element); 65 } 66 67 71 public boolean isSorterProperty(Object object, String propertyId) { 72 return propertyId.equals(IBasicPropertyConstants.P_TEXT); 73 } 74 } 75 | Popular Tags |