@Override
      public void treeStructureChanged(TreeModelEvent e) {
        if (e == null) {
          return;
        }
        TreePath parent = getPath(e);
        if (parent == null) {
          return;
        }
        if (parent.getPathCount() == 1) {
          clearToggledPaths();
          Object treeRoot = treeModel.getRoot();
          if (treeRoot != null && !treeModel.isLeaf(treeRoot)) {
            markPathExpanded(parent);
          }
        }
        else if (expandedState.get(parent) != null) {
          List<TreePath> toRemove = new ArrayList<>(1);
          boolean isExpanded = isExpanded(parent);
          toRemove.add(parent);
          removeDescendantToggledPaths(Collections.enumeration(toRemove));
          if (isExpanded) {
            TreeModel model = getModel();
            if (model == null || model.isLeaf(parent.getLastPathComponent())) {
              collapsePath(parent);
            }
            else {
              markPathExpanded(parent);
            }
          }
        }
        Tree.this.removeDescendantSelectedPaths(parent, false);
        if (cachedPresentation != null) {
          cachedPresentation.updateExpandedNodes(parent);
        }
      }
@Override
      public void treeStructureChanged(TreeModelEvent e)