Bug 24271 Source Folders: Sort Java Packages and Simple Folders Together
In Eclipse 1.0, packages and simple folders were not sorted together within the Project (as the source folder). Packages were (sorted) and placed first, followed by simple folders (that were also sorted). In Eclipse 2.0, the packages and simple folders are sorted together within the Project (as the source folder). Unfortunately, if you use Source Folders the packages and source folders are sorted as described above in Eclipse 1.0. It would be useful for packages and simple folders to be sorted together within their Source Folder.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/JavaElementSorter.java
private int compareWithLabelProvider(Viewer viewer, Object e1, Object e2) {
		if (viewer == null || !(viewer instanceof ContentViewer)) {
			IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
			if (prov instanceof ILabelProvider) {
				ILabelProvider lprov= (ILabelProvider) prov;
				String name1 = lprov.getText(e1);
				String name2 = lprov.getText(e2);
				if (name1 != null && name2 != null) {
					return getCollator().compare(name1, name2);
				}
			}
		}
		return 0; 
	}
			
	private int getClassPathIndex(IPackageFragmentRoot root) {
		try {
			IPath rootPath= root.getPath();
			IPackageFragmentRoot[] roots= root.getJavaProject().getPackageFragmentRoots();
			for (int i= 0; i < roots.length; i++) {
				if (roots[i].getPath().equals(rootPath)) {
					return i;
				}
			}
		} catch (JavaModelException e) {
		}
		return Integer.MAX_VALUE;
	}	
}