boolean (@NotNull Project project, @NotNull HierarchyNodeDescriptor ancestor, @NotNull HierarchyNodeDescriptor child) { PsiElement ancestorElement = ancestor.getPsiElement(); while (child != null) { PsiElement childElement = child.getPsiElement(); if (PsiManager.getInstance(project).areElementsEquivalent(ancestorElement, childElement)) return true; child = (HierarchyNodeDescriptor)child.getParentDescriptor(); } return false; }