Collection<TreeNode> (@NotNull final TreeNode treeNode) { final TreeNode[] pathToNode = ((RepositoryTreeModel)myRepositoryTree.getModel()).getPathToRoot(treeNode); final Enumeration<TreePath> expanded = myRepositoryTree.getExpandedDescendants(new TreePath(pathToNode)); final List<TreeNode> result = new ArrayList<>(); if (expanded != null) { while (expanded.hasMoreElements()) { final TreePath treePath = expanded.nextElement(); result.add((TreeNode)treePath.getLastPathComponent()); } } return result; }