boolean (PsiReferenceExpression qualified, final RefactoringUtil.IsDescendantOf descendantOf) { PsiClass aClass = PsiTreeUtil.getParentOfType(qualified, PsiClass.class); while (aClass != null) { if (descendantOf.value(aClass)) return true; aClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class); } return false; }