public void restore(BreakpointTree tree) {
      final List<TreePath> pathsToExpand = getPaths(tree, myExpandedUserObjects);
      if (!pathsToExpand.isEmpty()) {
        TreeUtil.restoreExpandedPaths(tree, pathsToExpand);
      }

      final List<TreePath> pathsToSelect = getPaths(tree, mySelectedUserObjects);
      if (!pathsToSelect.isEmpty()) {
        tree.getSelectionModel().clearSelection();
        tree.setSelectionPaths(pathsToSelect.toArray(new TreePath[pathsToSelect.size()]));
      }
    }
 public TreeStateSnapshot(BreakpointTree tree) {
   final List<TreePath> expandedPaths = TreeUtil.collectExpandedPaths(tree);
   myExpandedUserObjects =
       getUserObjects(expandedPaths.toArray(new TreePath[expandedPaths.size()]));
   mySelectedUserObjects = getUserObjects(tree.getSelectionPaths());
 }