private static PsiExpression getQualifier(@NotNull PsiElement element) {
    PsiExpression qualifier = null;
    if (element instanceof PsiReferenceExpression) {
      qualifier = ((PsiReferenceExpression)element).getQualifierExpression();
    }
    else if (element instanceof PsiMethodCallExpression) {
      qualifier = ((PsiMethodCallExpression)element).getMethodExpression().getQualifierExpression();
    }

    return qualifier instanceof PsiQualifiedExpression ? null : qualifier;
  }
private static PsiExpression getQualifier(@NotNull PsiElement element)