void (@NotNull VirtualFile toSelect, final TreeNode root) { for (int i = 0; i < root.getChildCount(); i++) { TreeNode child = root.getChildAt(i); VirtualFile file = ((FileNode)child).getObject(); if (VfsUtilCore.isAncestor(file, toSelect, false)) { if (Comparing.equal(file, toSelect)) { TreeUtil.selectNode(getTree(), child); getSelectionModel().clearSelection(); addSelectedPath(TreeUtil.getPathFromRoot(child)); TableUtil.scrollSelectionToVisible(this); } else { select(toSelect, child); } return; } } }