private static boolean shouldInsertStatementBody(@NotNull PsiElement statement, @NotNull Document doc, @Nullable PsiElement prev) {

    ASTNode block;
    ASTNode astNodeStatement = statement.getNode();
    if (BasicJavaAstTreeUtil.is(astNodeStatement, BASIC_WHILE_STATEMENT)) {
      block = BasicJavaAstTreeUtil.getBlock(astNodeStatement);
    }
    else {
      block = BasicJavaAstTreeUtil.getThenBranch(astNodeStatement);
    }
    ASTNode condition = BasicJavaAstTreeUtil.findChildByType(astNodeStatement, EXPRESSION_SET);
    ASTNode latestExpression = BasicJavaAstTreeUtil.getParentOfType(BasicJavaAstTreeUtil.toNode(prev), EXPRESSION_SET);
    if (BasicJavaAstTreeUtil.is(latestExpression, BASIC_NEW_EXPRESSION) &&
        BasicJavaAstTreeUtil.getAnonymousClass(latestExpression) == null) {
      return false;
    }
    return !(BasicJavaAstTreeUtil.is(block, BASIC_BLOCK_STATEMENT)) &&
           (block == null || startLine(doc, block) != startLine(doc, astNodeStatement) || condition == null);
  }
private static boolean shouldInsertStatementBody(@NotNull PsiElement statement, @NotNull Document doc, @Nullable PsiElement prev)