private boolean shouldAllParentsBeExpanded(
      @NotNull TreePath path,
      @NotNull Set<@NotNull TreePath> toExpand,
      @NotNull Set<@NotNull TreePath> toNotExpand
    ) {
      Deque<TreePath> stack = null;
      TreePath parentPath = path;
      var result = true;
      while (parentPath != null) {
        if (isExpanded(parentPath) || toExpand.contains(parentPath)) {
          parentPath = null;
        }
        else if (toNotExpand.contains(parentPath)) {
          parentPath = null;
          result = false;
        }
        else {
          if (stack == null) {
            stack = new ArrayDeque<>();
          }
          stack.push(parentPath);
          parentPath = parentPath.getParentPath();
        }
      }
      while (stack != null && !stack.isEmpty()) {
        parentPath = stack.pop();
        if (result) {
          try {
            fireTreeWillExpand(parentPath);
          }
          catch (ExpandVetoException eve) {
            result = false;
          }
        }
        if (result) {
          toExpand.add(parentPath);
        }
        else {
          toNotExpand.add(parentPath);
        }
      }
      return result;
    }
private boolean shouldAllParentsBeExpanded(
      @NotNull TreePath path,
      @NotNull Set<@NotNull TreePath> toExpand,
      @NotNull Set<@NotNull TreePath> toNotExpand
    )