private static boolean shouldSuggestSmartCompletion(PsiElement element) {
    if (shouldSuggestClassNameCompletion(element)) return false;

    PsiElement parent = element.getParent();
    if (parent instanceof PsiReferenceExpression && ((PsiReferenceExpression)parent).getQualifier() != null) return false;
    if (parent instanceof PsiReferenceExpression && parent.getParent() instanceof PsiReferenceExpression) return true;

    return ExpectedTypesGetter.getExpectedTypes(element, false).length > 0;
  }
private static boolean shouldSuggestSmartCompletion(PsiElement element)