private void restorePath(ArrayList<Object> newPath, int idx) {
      if (idx >= myPath.length) return;
      InspectionTreeNode oldNode = (InspectionTreeNode) myPath[idx];

      InspectionTreeNode newRoot = (InspectionTreeNode) newPath.get(idx - 1);

      InspectionResultsViewComparator comparator = InspectionResultsViewComparator.getInstance();
      Enumeration children = newRoot.children();
      while (children.hasMoreElements()) {
        InspectionTreeNode child = (InspectionTreeNode) children.nextElement();
        if (comparator.compare(child, oldNode) == 0) {
          newPath.add(child);
          restorePath(newPath, idx + 1);
          return;
        }
      }

      // Exactly same element not found. Trying to select somewhat near.
      int count = newRoot.getChildCount();
      if (count > 0) {
        if (myIndicies[idx] < count) {
          newPath.add(newRoot.getChildAt(myIndicies[idx]));
        } else {
          newPath.add(newRoot.getChildAt(count - 1));
        }
      }
    }
 private static void traverseDescriptors(
     InspectionTreeNode node, LinkedHashSet<CommonProblemDescriptor> descriptors) {
   if (node instanceof ProblemDescriptionNode) {
     descriptors.add(((ProblemDescriptionNode) node).getDescriptor());
   }
   for (int i = node.getChildCount() - 1; i >= 0; i--) {
     traverseDescriptors((InspectionTreeNode) node.getChildAt(i), descriptors);
   }
 }