Bug 35381 Newly added items are not inserted at correct position in package explorer
I20030319 (RC3) On MacOS X: - create new Java project "test" - select project - create folder "A" inside this project Observe: "A" shows up as last child of "test" - collapse tree node "test" - exapnd tree node "test" Observe: now "A" shows up at correct position
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/JavaElementSorter.java
}
			}
			return params1.length - params2.length;
		}
		return 0;
	}
	
	private IPackageFragmentRoot getPackageFragmentRoot(Object element) {
		if (element instanceof ClassPathContainer) {
			
			ClassPathContainer cp= (ClassPathContainer)element;
			Object[] roots= cp.getPackageFragmentRoots();
			if (roots.length > 0)
				return (IPackageFragmentRoot)roots[0];
			
			return null;
		}
		return JavaModelUtil.getPackageFragmentRoot((IJavaElement)element);
	}
	
	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);
				}