public void expandAll() {
   ResourceTreeModel model = (ResourceTreeModel) tree.getModel();
   if (model != null) {
     ResourceTreeFolder root = (ResourceTreeFolder) model.getRoot();
     processAllNodes(tree, new TreePath(root), true);
   }
 }
 public void collapseAll() {
   ResourceTreeModel model = (ResourceTreeModel) tree.getModel();
   if (model != null) {
     ResourceTreeFolder root = (ResourceTreeFolder) model.getRoot();
     processAllNodes(tree, new TreePath(root), false);
     tree.expandPath(new TreePath(root)); // virtual root node is always expanded
   }
 }