boolean (@NotNull PsiDirectory directory, @NotNull PsiDirectory owner, @NotNull Processor<? super PsiDirectory> processor) { for (directory = directory.getParentDirectory(); directory != null && !directory.equals(owner); directory = directory.getParentDirectory()) { if (!processor.process(directory)) return false; } return true; }