boolean (PsiDirectory directory, PsiDirectory parentCandidate) { while (directory != null) { if (directory.equals(parentCandidate)) return true; directory = directory.getParentDirectory(); } return false; }