void (@NotNull DefaultMutableTreeNode node, boolean almostAllChildrenExcluded, @NotNull Set<? super Node> nodes) { TreeNode parent = node.getParent(); if (parent == myRoot || !(parent instanceof GroupNode parentNode)) return; List<Node> otherNodes; synchronized (parentNode) { otherNodes = ContainerUtil.filter(parentNode.getChildren(), n -> n.isExcluded() != almostAllChildrenExcluded); } if (otherNodes.size() == 1 && otherNodes.get(0) == node) { nodes.add(parentNode); collectParentNodes(parentNode, almostAllChildrenExcluded, nodes); } }