boolean (final VirtualFile file, boolean optimizeByCheckingFileRootsFirst) { VirtualFile parent = file.getParent(); boolean mayContain = false; if (optimizeByCheckingFileRootsFirst && parent != null) { Collection<VirtualFile> roots = getRoots(); for (VirtualFile eachRoot : roots) { if (parent.equals(eachRoot.getParent())) { mayContain = true; break; } if (VfsUtilCore.isAncestor(eachRoot, file, true)) { mayContain = true; break; } } } else { mayContain = true; } if (!mayContain) { return false; } Collection<? extends AbstractTreeNode<?>> kids = getChildren(); for (final AbstractTreeNode<?> kid : kids) { ProjectViewNode<?> node = (ProjectViewNode<?>)kid; if (node.contains(file)) return true; } return false; }