protected void restoreTree() {
    Pair<ElementNode, List<ElementNode>> selection = storeSelection();

    DefaultMutableTreeNode root = getRootNode();
    if (!myShowClasses || myContainerNodes.isEmpty()) {
      List<ParentNode> otherObjects = new ArrayList<>();
      Enumeration<TreeNode> children = getRootNodeChildren();
      ParentNode newRoot = new ParentNode(null, new MemberChooserObjectBase(getAllContainersNodeName()), new Ref<>(0));
      while (children.hasMoreElements()) {
        final ParentNode nextElement = (ParentNode)children.nextElement();
        if (nextElement instanceof ContainerNode containerNode) {
          Enumeration<TreeNode> memberNodes = containerNode.children();
          List<MemberNode> memberNodesList = new ArrayList<>();
          while (memberNodes.hasMoreElements()) {
            memberNodesList.add((MemberNode)memberNodes.nextElement());
          }
          for (MemberNode memberNode : memberNodesList) {
            newRoot.add(memberNode);
          }
        }
        else {
          otherObjects.add(nextElement);
        }
      }
      replaceChildren(root, otherObjects);
      sortNode(newRoot, myComparator);
      if (newRoot.children().hasMoreElements()) root.add(newRoot);
    }
    else {
      Enumeration<TreeNode> children = getRootNodeChildren();
      while (children.hasMoreElements()) {
        ParentNode allClassesNode = (ParentNode)children.nextElement();
        Enumeration<TreeNode> memberNodes = allClassesNode.children();
        ArrayList<MemberNode> arrayList = new ArrayList<>();
        while (memberNodes.hasMoreElements()) {
          arrayList.add((MemberNode)memberNodes.nextElement());
        }
        arrayList.sort(myComparator);
        for (MemberNode memberNode : arrayList) {
          myNodeToParentMap.get(memberNode).add(memberNode);
        }
      }
      replaceChildren(root, myContainerNodes);
    }
    myTreeModel.nodeStructureChanged(root);

    defaultExpandTree();

    restoreSelection(selection);
  }
protected void restoreTree()