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

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

Introduction

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

Prototype

public Statement getBody() 

Source Link

Document

Returns the body of this while statement.

Usage

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

License:Open Source License

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

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

License:Apache License

@Override
public boolean visit(WhileStatement 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.WHILE);
    node.getExpression().accept(this);
    b.setExpression(expressions.pop());//from  w  w  w  .jav  a2s.  co  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(WhileStatement 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 {/*w  ww.jav a 2 s  .  c  o m*/
        languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine,
                beginColumn, endColumn));
    }

    return true;
}

From source file:cc.kave.eclipse.commons.analysis.transformer.BodyVisitor.java

License:Apache License

@Override
public boolean visit(WhileStatement stmt) {

    if (marker.getAffectedNode() == stmt && marker.getCase() == CompletionCase.EmptyCompletionBefore) {
        body.add(getEmptyCompletionExpression());
    }//from  w  w w .  j  a va 2 s . c o  m

    WhileLoop loop = new WhileLoop();
    // TODO: Condition = _exprVisitor.ToLoopHeaderExpression(stmt.Condition,
    // body)
    loop.setCondition(exprVisitor.toLoopHeaderExpression(stmt, body));

    body.add(loop);

    stmt.getBody().accept(new BodyVisitor(nameGen, marker, loop.getBody()));

    if (marker.getAffectedNode() == stmt && marker.getCase() == CompletionCase.InBody) {
        loop.getBody().add(getEmptyCompletionExpression());
    }

    if (marker.getAffectedNode() == stmt && marker.getCase() == CompletionCase.EmptyCompletionAfter) {
        body.add(getEmptyCompletionExpression());
    }
    return super.visit(stmt);
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(WhileStatement node) {
    printIndent();//from   w w w  . j a va2  s  .  co m
    this.buffer.append("while (");//$NON-NLS-1$
    node.getExpression().accept(this);
    this.buffer.append(") ");//$NON-NLS-1$
    node.getBody().accept(this);
    return false;
}

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

License:Open Source License

@Override
public boolean visit(WhileStatement node) {
    handleLoopBody(node.getBody());
    return true;
}

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

License:Open Source License

@Override
public boolean visit(WhileStatement node) {
    handleToken(node, TokenNameLPAREN, this.options.insert_space_before_opening_paren_in_while,
            this.options.insert_space_after_opening_paren_in_while);
    handleTokenBefore(node.getBody(), TokenNameRPAREN, this.options.insert_space_before_closing_paren_in_while,
            false);//from   www  . jav  a2  s  . c  o  m
    return true;
}

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

License:Open Source License

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

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

License:Apache License

@Override
public boolean visit(WhileStatement node) {
    sb.printIndent();/*  w  ww.  j a  v  a 2 s  . c  om*/
    sb.print("while (");
    node.getExpression().accept(this);
    sb.print(") ");
    node.getBody().accept(this);
    return false;
}

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

License:Apache License

/** Visitor method for {@link WhileStatement}s. */
@Override//from w w w.j a v a2 s. co m
public boolean visit(WhileStatement node) {
    sync(node);
    token("while");
    builder.space();
    token("(");
    node.getExpression().accept(this);
    token(")");
    visitStatement(node.getBody(), CollapseEmptyOrNot.YES, AllowLeadingBlankLine.YES,
            AllowTrailingBlankLine.NO);
    return false;
}