1 11 package org.eclipse.search.internal.ui.text; 12 13 import org.eclipse.core.resources.IResource; 14 15 import org.eclipse.jface.viewers.Viewer; 16 import org.eclipse.jface.viewers.ViewerSorter; 17 18 public class NameSorter extends ViewerSorter { 19 public int compare(Viewer viewer, Object e1, Object e2) { 20 return compare((IResource)e1, (IResource)e2); 21 } 22 23 protected int compare(IResource resource, IResource resource2) { 24 String property1= getProperty(resource); 25 String property2= getProperty(resource2); 26 return collator.compare(property1, property2); 27 } 28 29 protected String getProperty(IResource resource) { 30 return resource.getName(); 31 } 32 } 33 | Popular Tags |