Bug 60101 Sort by parent path should take method name into account
build i0420:0800 - I do a Java Search and sort the results by Parent Path - I believe the secondary sort consideration should be the method name - this would make the results sorted alphabetically Here are the currently results. Note I removed part of the package name to make the list clearer. (#addChild is out of order alphabetically) I'm not sure what order its listed in...#addChild is at the beginning of the java file so its not by order of appearance in the file. preferences.EclipsePreferences.childrenNames() preferences.EclipsePreferences.getChild(String) (2 matches) preferences.EclipsePreferences.getChildren() (2 matches) preferences.EclipsePreferences.removeNode(IEclipsePreferences) (4 matches) preferences.EclipsePreferences.addChild(String, IEclipsePreferences) (3 matches) preferences.RootPreferences.getChild(String) (2 matches)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/ParentSorter.java
public int compare(Viewer viewer, Object e1, Object e2) {
		String leftParent= getParentName(e1);
		String rightParent= getParentName(e2);
		return collator.compare(leftParent, rightParent);
	}
	
	private String getParentName(Object element) {
		if (element instanceof IJavaElement) {
			IJavaElement parent= ((IJavaElement)element).getParent();
			if (parent instanceof IType)
				return ((IType)parent).getFullyQualifiedName();
			if (parent != null)
				return parent.getElementName();
		}
		if (element instanceof IResource) {
			IResource parent= ((IResource)element).getParent();
			if (parent != null)
				return parent.getName();
		}
		return ""; 
	}
}