1 11 package org.eclipse.search.internal.ui.text; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.core.runtime.IPath; 15 16 public class PathSorter extends NameSorter { 17 protected int compare(IResource left, IResource right) { 18 IPath path1= left.getFullPath(); 19 IPath path2= right.getFullPath(); 20 int segmentCount= Math.min(path1.segmentCount(), path2.segmentCount()); 21 for (int i= 0; i < segmentCount; i++) { 22 int value= collator.compare(path1.segment(i), path2.segment(i)); 23 if (value != 0) 24 return value; 25 } 26 return path1.segmentCount() - path2.segmentCount(); 27 } 28 } 29 | Popular Tags |