// collation, and which also sorts directories before files.
// There is also a public int category(Object node) method
// for the sorter, to sort objects by a user-defined category
// (e.g. return -1 for a directory and 1 for a file). This
// did not work.
treeViewer.setSorter(new ViewSorter(null) {
public int compare(Viewer viewer, Object node1, Object node2) {
File file1 = (File) node1;
File file2 = (File) node2;
if (file1.isDirectory() && file2.isFile()) {
return -1;