boolean () { if (myPosition.getParent() instanceof PsiJavaCodeReferenceElement) { final PsiElement qualifier = ((PsiJavaCodeReferenceElement)myPosition.getParent()).getQualifier(); if (qualifier instanceof PsiJavaCodeReferenceElement) { final PsiElement qualifierClass = ((PsiJavaCodeReferenceElement)qualifier).resolve(); if (qualifierClass instanceof PsiClass) { PsiElement parent = myPosition; final PsiManager psiManager = myPosition.getManager(); while ((parent = PsiTreeUtil.getParentOfType(parent, PsiClass.class, true)) != null) { if (psiManager.areElementsEquivalent(parent, qualifierClass)) { return true; } } } } } return false; }