void (TreePath path) { int row = AdvancedSettings.getBoolean("ide.tree.collapse.recursively") ? getRowForPath(path) : -1; if (row < 0) { super.collapsePath(path); } else if (!isAlwaysExpanded(path)) { ArrayDeque<TreePath> deque = new ArrayDeque<>(); deque.addFirst(path); while (++row < getRowCount()) { TreePath next = getPathForRow(row); if (!path.isDescendant(next)) break; if (isExpanded(next)) deque.addFirst(next); } deque.forEach(super::collapsePath); } }