Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.EnhancedForStatement


     * @param type iteration variable type
     * @param expr iteration source expression
     * @param block statement body block
     */
    public void addSugaredForStatement(String name, String type, ExpressionBuilderBase expr, BlockBuilder block) {
        EnhancedForStatement stmt = m_ast.newEnhancedForStatement();
        stmt.setExpression(expr.getExpression());
        SingleVariableDeclaration decl = m_ast.newSingleVariableDeclaration();
        decl.setName(m_ast.newSimpleName(name));
        decl.setType(m_source.createType(type));
        stmt.setParameter(decl);
        stmt.setBody(block.getStatement());
        m_block.statements().add(stmt);
    }
View Full Code Here


  public boolean isEnhancedForLoopVariable() {
    ASTNode parent = this.getNode().getParent();
    if (parent instanceof EnhancedForStatement) {
      // This is not enough. We must make sure that this variable
      // is being declared inside the declaration part.
      EnhancedForStatement loop = (EnhancedForStatement) parent;
      if (loop.getParameter().equals(this.getNode()) ) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.EnhancedForStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.