private static boolean checkUnableToInsertCodeBlock(final PsiCodeBlock methodBody,
                                                      final PsiElement element,
                                                      final Predicate<? super PsiMethodCallExpression> errorCondition) {
    PsiStatement[] statements = methodBody.getStatements();
    if (statements.length > 1 || statements.length == 1 &&
                                 !(statements[0] instanceof PsiExpressionStatement) &&
                                 !(statements[0] instanceof PsiReturnStatement)) {
      PsiMethodCallExpression expr = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class, true, PsiStatement.class);
      while (expr != null) {
        if (errorCondition.test(expr)) {
          return true;
        }
        expr = PsiTreeUtil.getParentOfType(expr, PsiMethodCallExpression.class, true, PsiStatement.class);
      }
    }
    return false;
  }
private static boolean checkUnableToInsertCodeBlock(final PsiCodeBlock methodBody,
                                                      final PsiElement element,
                                                      final Predicate<? super PsiMethodCallExpression> errorCondition)