List of usage examples for org.eclipse.jdt.core.dom EnhancedForStatement EnhancedForStatement
EnhancedForStatement(AST ast)
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
public Statement convert(ForeachStatement statement) { switch (this.ast.apiLevel) { case AST.JLS2_INTERNAL: return createFakeEmptyStatement(statement); default:/*from ww w. j ava 2 s .co m*/ EnhancedForStatement enhancedForStatement = new EnhancedForStatement(this.ast); enhancedForStatement.setParameter(convertToSingleVariableDeclaration(statement.elementVariable)); org.eclipse.jdt.internal.compiler.ast.Expression collection = statement.collection; if (collection == null) return null; enhancedForStatement.setExpression(convert(collection)); final Statement action = convert(statement.action); if (action == null) return null; enhancedForStatement.setBody(action); int start = statement.sourceStart; int end = statement.sourceEnd; enhancedForStatement.setSourceRange(start, end - start + 1); return enhancedForStatement; } }