private void captureUsagesExpandState(TreePath pathFrom, final Collection<UsageState> states) {
   if (!myTree.isExpanded(pathFrom)) {
     return;
   }
   final DefaultMutableTreeNode node = (DefaultMutableTreeNode) pathFrom.getLastPathComponent();
   final int childCount = node.getChildCount();
   for (int idx = 0; idx < childCount; idx++) {
     final TreeNode child = node.getChildAt(idx);
     if (child instanceof UsageNode) {
       final Usage usage = ((UsageNode) child).getUsage();
       states.add(
           new UsageState(
               usage,
               myTree.getSelectionModel().isPathSelected(pathFrom.pathByAddingChild(child))));
     } else {
       captureUsagesExpandState(pathFrom.pathByAddingChild(child), states);
     }
   }
 }
 public void restore() {
   final UsageNode node = myUsageNodes.get(myUsage);
   if (node == NULL_NODE || node == null) {
     return;
   }
   final DefaultMutableTreeNode parentGroupingNode = (DefaultMutableTreeNode) node.getParent();
   if (parentGroupingNode != null) {
     final TreePath treePath = new TreePath(parentGroupingNode.getPath());
     myTree.expandPath(treePath);
     if (mySelected) {
       myTree.addSelectionPath(treePath.pathByAddingChild(node));
     }
   }
 }