1 11 12 package org.eclipse.ui.internal.quickaccess; 13 14 import java.util.Arrays ; 15 import java.util.Comparator ; 16 17 import org.eclipse.jface.resource.ImageDescriptor; 18 19 23 public abstract class QuickAccessProvider { 24 25 private QuickAccessElement[] sortedElements; 26 27 32 public abstract String getId(); 33 34 39 public abstract String getName(); 40 41 46 public abstract ImageDescriptor getImageDescriptor(); 47 48 53 public abstract QuickAccessElement[] getElements(); 54 55 public QuickAccessElement[] getElementsSorted() { 56 if (sortedElements == null) { 57 sortedElements = getElements(); 58 Arrays.sort(sortedElements, new Comparator () { 59 public int compare(Object o1, Object o2) { 60 QuickAccessElement e1 = (QuickAccessElement) o1; 61 QuickAccessElement e2 = (QuickAccessElement) o2; 62 return e1.getLabel().compareTo(e2.getLabel()); 63 } 64 }); 65 } 66 return sortedElements; 67 } 68 69 77 public abstract QuickAccessElement getElementForId(String id); 78 } 79 | Popular Tags |