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
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IInitializer;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.preferences.MembersOrderPreferencePage;
/**
 * Sorter for Java elements. Ordered by element category, then by element name. 
 * Package fragment roots are sorted as ordered on the classpath.
 * 
 * <p>
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @since 2.0
 */
public class JavaElementSorter extends ViewerSorter {