Examples of statements()


Examples of org.eclipse.jdt.core.dom.Block.statements()

            ClassInstanceCreation proxy = ast.newClassInstanceCreation();
            proxy
                    .setType(ast.newSimpleType(ast
                            .newSimpleName(_getProxyName())));
            addInvocation.arguments().add(proxy);
            body.statements().add(ast.newExpressionStatement(addInvocation));
            bodyDeclarations.add(initializer);

            if (declarationRecord != null) {
                declarationRecord._addExtendedDeclaration(initializer);
            }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

             
              Block block = getBlock(target);
             
              int index = 0;
             
              for (int i = 0; i < block.statements().size(); i++) {
                if (block.statements().get(i).equals(target)) {
                  index = i;
                  break;
                }
              }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

              Block block = getBlock(target);
             
              int index = 0;
             
              for (int i = 0; i < block.statements().size(); i++) {
                if (block.statements().get(i).equals(target)) {
                  index = i;
                  break;
                }
              }
             
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

              }
             
              List statements = ASTNode.copySubtrees(node.getAST(), newBlock.statements());
             
              for (int i = statements.size() - 1; i >= 0; i--) {
                block.statements().add(index, statements.get(i));
              }
             
              int expressionIndex = index + statements.size() - 1;
              boolean assignmentAdded = false;
             
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

             
              int expressionIndex = index + statements.size() - 1;
              boolean assignmentAdded = false;
             
              if (node.getParent() instanceof VariableDeclarationFragment) {
                Statement expressionStatement = (Statement) block.statements().get(expressionIndex);
               
                if (expressionStatement instanceof ExpressionStatement) {
                  VariableDeclarationFragment vdf = (VariableDeclarationFragment) node.getParent();
                  Expression expression = (Expression) ASTNode.copySubtree(node.getAST(), ((ExpressionStatement) expressionStatement).getExpression());
                  vdf.setInitializer(expression);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

               
                if (expressionStatement instanceof ExpressionStatement) {
                  VariableDeclarationFragment vdf = (VariableDeclarationFragment) node.getParent();
                  Expression expression = (Expression) ASTNode.copySubtree(node.getAST(), ((ExpressionStatement) expressionStatement).getExpression());
                  vdf.setInitializer(expression);
                  block.statements().remove(expressionIndex);
                  assignmentAdded = true;
                }
              }
             
              if (! assignmentAdded) {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

                  assignmentAdded = true;
                }
              }
             
              if (! assignmentAdded) {
                block.statements().remove(expressionIndex + 1);
              }
            }
          } catch (JavaModelException e) {
            e.printStackTrace();
          }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

        if (parent instanceof Block) {
          return (Block) parent;
        }
       
        Block newBlock = target.getAST().newBlock();
        newBlock.statements().add(ASTNode.copySubtree(target.getAST(), target));
        Field[] declaredFields = parent.getClass().getDeclaredFields();
        for (Field field : declaredFields) {
          if (!(field.getType().isAssignableFrom(Statement.class))) {
            continue;
          }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

    AST ast = manager.getFirstReference().getAST();
    VariableDeclarationStatement statement = createNewVariableDeclarationStatement(
        manager, ast);
    int firstReferenceIndex = getFirstReferenceListIndex(manager);
    Block block = Helper.getParentBlock(manager.getFirstReference());
    block.statements().add(firstReferenceIndex, statement);
  }

  /*
   * (non-Javadoc)
   *
 
View Full Code Here

Examples of org.eclipse.jdt.core.dom.Block.statements()

   *            the variable binding manager
   * @return the index position within the statement list
   */
  protected int getFirstReferenceListIndex(VariableBindingManager manager) {
    Block block = Helper.getParentBlock(manager.getFirstReference());
    return block.statements().indexOf(manager.getFirstReference());
  }

  /**
   * Creates a new {@link VariableDeclarationStatement}. As initializer
   * figures a copy of the initializer retrieved from the variable binding
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.