Example usage for org.eclipse.jdt.core.dom DoStatement getBody

List of usage examples for org.eclipse.jdt.core.dom DoStatement getBody

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom DoStatement getBody.

Prototype

public Statement getBody() 

Source Link

Document

Returns the body of this do statement.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(DoStatement node) {
    this.fBuffer.append("do ");//$NON-NLS-1$
    node.getBody().accept(this);
    this.fBuffer.append(" while (");//$NON-NLS-1$
    node.getExpression().accept(this);
    this.fBuffer.append(");");//$NON-NLS-1$
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(DoStatement node) {
    boa.types.Ast.Statement.Builder b = boa.types.Ast.Statement.newBuilder();
    //      b.setPosition(pos.build());
    List<boa.types.Ast.Statement> list = statements.peek();
    b.setKind(boa.types.Ast.Statement.StatementKind.DO);
    node.getExpression().accept(this);
    b.setExpression(expressions.pop());/*from w ww.java 2s  .  c o  m*/
    statements.push(new ArrayList<boa.types.Ast.Statement>());
    node.getBody().accept(this);
    for (boa.types.Ast.Statement s : statements.pop())
        b.addStatements(s);
    list.add(b.build());
    return false;
}

From source file:br.uff.ic.gems.resources.ast.Visitor.java

@Override
public boolean visit(DoStatement node) {
    int beginLine = cu.getLineNumber(node.getStartPosition());
    int endLine = cu.getLineNumber(node.getStartPosition() + node.getLength());
    int beginColumn = cu.getColumnNumber(node.getStartPosition());
    int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength());

    Statement body = node.getBody();

    if (body != null) {

        int beginLineBody = cu.getLineNumber(body.getStartPosition());
        int endLineBody = cu.getLineNumber(body.getStartPosition() + body.getLength());
        int beginColumnBody = cu.getColumnNumber(body.getStartPosition());
        int endColumnBody = cu.getColumnNumber(body.getStartPosition() + body.getLength());

        languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine,
                beginColumn, endColumn, beginLineBody, endLineBody, beginColumnBody, endColumnBody, null));
    } else {/*from  w  w w . j  ava2 s  .  c  o m*/
        languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine,
                beginColumn, endColumn));
    }
    return true;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(DoStatement node) {
    printIndent();//from ww  w.  ja v a  2  s . com
    this.buffer.append("do ");//$NON-NLS-1$
    node.getBody().accept(this);
    this.buffer.append(" while (");//$NON-NLS-1$
    node.getExpression().accept(this);
    this.buffer.append(");\n");//$NON-NLS-1$
    return false;
}

From source file:com.bsiag.eclipse.jdt.java.formatter.LineBreaksPreparator.java

License:Open Source License

@Override
public boolean visit(DoStatement node) {
    Statement body = node.getBody();
    handleLoopBody(body);//  w w w .ja va 2  s .  c  o  m
    if (this.options.insert_new_line_before_while_in_do_statement
            || (!(body instanceof Block) && !(body instanceof EmptyStatement))) {
        Token whileToken = this.tm.firstTokenBefore(node.getExpression(), TokenNamewhile);
        whileToken.breakBefore();
    }
    return true;
}

From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java

License:Open Source License

@Override
public boolean visit(DoStatement node) {
    handleTokenBefore(node.getExpression(), TokenNameLPAREN,
            this.options.insert_space_before_opening_paren_in_while,
            this.options.insert_space_after_opening_paren_in_while);
    handleTokenBefore(node.getExpression(), TokenNamewhile,
            !(node.getBody() instanceof Block) || this.options.insert_space_after_closing_brace_in_block,
            false);//from w  ww  .  j av a  2  s  .co m
    handleTokenAfter(node.getExpression(), TokenNameRPAREN,
            this.options.insert_space_before_closing_paren_in_while, false);
    return true;
}

From source file:com.google.dart.java2dart.SyntaxTranslator.java

License:Open Source License

@Override
public boolean visit(org.eclipse.jdt.core.dom.DoStatement node) {
    return done(doStatement((Statement) translate(node.getBody()), translateExpression(node.getExpression())));
}

From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java

License:Open Source License

@Override
public boolean visit(DoStatement node) {
    buffer.append("do ");
    node.getBody().accept(this);
    buffer.append(" while (");
    node.getExpression().accept(this);
    buffer.append(");\n");
    return false;
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(DoStatement node) {
    sb.printIndent();//from   w ww  . ja  v  a2 s . c  om
    sb.print("do ");
    node.getBody().accept(this);
    sb.print(" while (");
    node.getExpression().accept(this);
    sb.println(");");
    return false;
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

/** Visitor method for {@link DoStatement}s. */
@Override/*w w  w. ja  va 2  s  . c o  m*/
public boolean visit(DoStatement node) {
    sync(node);
    token("do");
    visitStatement(node.getBody(), CollapseEmptyOrNot.YES, AllowLeadingBlankLine.YES,
            AllowTrailingBlankLine.YES);
    if (node.getBody().getNodeType() == ASTNode.BLOCK) {
        builder.space();
    } else {
        builder.breakOp(" ");
    }
    token("while");
    builder.space();
    token("(");
    node.getExpression().accept(this);
    token(")");
    token(";");
    return false;
}