Example usage for org.eclipse.jdt.core.dom IfStatement IfStatement

List of usage examples for org.eclipse.jdt.core.dom IfStatement IfStatement

Introduction

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

Prototype

IfStatement(AST ast) 

Source Link

Document

Creates a new unparented if statement node owned by the given AST.

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public IfStatement convert(org.eclipse.jdt.internal.compiler.ast.IfStatement statement) {
    IfStatement ifStatement = new IfStatement(this.ast);
    ifStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
    ifStatement.setExpression(convert(statement.condition));
    final Statement thenStatement = convert(statement.thenStatement);
    if (thenStatement == null)
        return null;
    ifStatement.setThenStatement(thenStatement);
    org.eclipse.jdt.internal.compiler.ast.Statement statement2 = statement.elseStatement;
    if (statement2 != null) {
        final Statement elseStatement = convert(statement2);
        if (elseStatement != null) {
            ifStatement.setElseStatement(elseStatement);
        }/*from   w  ww  .jav  a  2  s .  com*/
    }
    return ifStatement;
}