boolean (@NotNull PsiElement element) { if (!(element instanceof PsiReferenceExpression)) return false; PsiElement parent = element.getParent(); if (!(parent instanceof PsiReferenceExpression)) return false; return ((PsiReferenceExpression)parent).getQualifierExpression() == element; }