boolean (@NotNull final VirtualFile baseDir, @NotNull VirtualFile childDir) { if (!childDir.isDirectory()) { childDir = childDir.getParent(); } ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(myProject); while (true) { if (childDir == null) return false; if (childDir.equals(baseDir)) return true; if (!fileIndex.isInProject(childDir)) return false; childDir = childDir.getParent(); } }