private static boolean checkForStringIsEmpty(GrExpression condition, GrExpression elseBranch) {
    if (condition instanceof GrMethodCall) condition = ((GrMethodCall)condition).getInvokedExpression();
    if (!(condition instanceof GrReferenceExpression)) return false;

    final GrExpression qualifier = ((GrReferenceExpression)condition).getQualifier();
    if (qualifier == null) return false;

    if (!PsiEquivalenceUtil.areElementsEquivalent(qualifier, elseBranch)) return false;

    final PsiType type = qualifier.getType();
    if (type == null) return false;
    if (!type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) return false;

    final PsiElement resolved = ((GrReferenceExpression)condition).resolve();

    return resolved instanceof PsiMethod &&
           "isEmpty".equals(((PsiMethod)resolved).getName()) &&
           ((PsiMethod)resolved).getParameterList().isEmpty();
  }
private static boolean checkForStringIsEmpty(GrExpression condition, GrExpression elseBranch)