boolean (@NotNull VirtualFile ancestor, @NotNull VirtualFile file, boolean strict) { if (!file.getFileSystem().equals(ancestor.getFileSystem())) return false; VirtualFile parent = strict ? file.getParent() : file; while (true) { if (parent == null) return false; if (parent.equals(ancestor)) return true; parent = parent.getParent(); } }