Package org.eclipse.jdt.core.dom

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


     * Add operand to expression. This just adds the supplied operand expression as a new initializer value.
     *
     * @param operand
     */
    protected void addOperand(Expression operand) {
        ArrayInitializer init = m_arrayCreation.getInitializer();
        if (init == null) {
            init = m_ast.newArrayInitializer();
            m_arrayCreation.setInitializer(init);
        }
        init.expressions().add(operand);
    }
View Full Code Here


  /**
   * Example: new int[10]{1,2,3,4,5,6,7,8,9,10};
   */
  public boolean visit(ArrayCreation node) {
    List dimensions = node.dimensions();
    ArrayInitializer arrayInitializer = node.getInitializer();
    List<ControlFlowNode> cfns = null;

    if(dimensions != null && dimensions.size() > 0) {
      // Handle dimension expressions
      cfns = createCFNListFromASTNodeList(dimensions);
View Full Code Here

  protected void parseAnnotationListElement(HashMap<String, String> elems,
      String annotationName, String nameProp, String colProp,
      Expression exp) {
    if (exp instanceof ArrayInitializer) {
      ArrayInitializer ai = (ArrayInitializer) exp;
      List<Expression> expL = ai.expressions();
      for (Expression e : expL) {
        parseAnnotationElement(elems, annotationName, nameProp,
            colProp, e);
      }
    }
View Full Code Here

            recordInvocation.arguments().add(ast.newNullLiteral());
        } else {
            ArrayCreation arrayCreation = ast.newArrayCreation();
            ArrayType arrayType = ast.newArrayType(ast
                    .newPrimitiveType(PrimitiveType.INT));
            ArrayInitializer initializer = ast.newArrayInitializer();

            for (int i = 0; i < indices; i++) {
                initializer.expressions().add(ast.newSimpleName("index" + i));
            }

            arrayCreation.setType(arrayType);
            arrayCreation.setInitializer(initializer);
            recordInvocation.arguments().add(arrayCreation);
View Full Code Here

            backup.arguments().add(ast.newNullLiteral());
        } else {
            ArrayCreation arrayCreation = ast.newArrayCreation();
            ArrayType arrayType = ast.newArrayType(ast
                    .newPrimitiveType(PrimitiveType.INT));
            ArrayInitializer initializer = ast.newArrayInitializer();

            for (int i = 0; i < indices; i++) {
                initializer.expressions().add(ast.newSimpleName("index" + i));
            }

            arrayCreation.setType(arrayType);
            arrayCreation.setInitializer(initializer);
            backup.arguments().add(arrayCreation);
View Full Code Here

        ArrayCreation initializer = ast.newArrayCreation();
        String typeName = getClassName(FieldRecord.class, state, root);
        initializer.setType(ast.newArrayType(createType(ast, typeName)));

        Iterator fields = fieldNames.iterator();
        ArrayInitializer arrayInitializer = ast.newArrayInitializer();
        initializer.setInitializer(arrayInitializer);

        List expressions = arrayInitializer.expressions();

        while (fields.hasNext()) {
            String fieldName = (String) fields.next();

            String recordName = _getRecordName(fieldName);
View Full Code Here

      this.processExpression(creation.getInitializer());
      break;
    }

    case ASTNode.ARRAY_INITIALIZER: {
      final ArrayInitializer init = (ArrayInitializer) node;
      for (final Iterator it = init.expressions().iterator(); it
          .hasNext();) {
        final Expression exp = (Expression) it.next();
        this.processExpression(exp);
      }
      break;
View Full Code Here

   * Creates new {@link ColumnConfigInfo}.
   */
  public void command_CREATE(ColumnConfigInfo column, ColumnConfigInfo nextColumn) throws Exception {
    ArrayCreation columnsArray = getColumnsArray(true);
    Assert.isNotNull(columnsArray);
    ArrayInitializer arrayInitializer = columnsArray.getInitializer();
    // fire before event
    getBroadcast(ObjectInfoChildAddBefore.class).invoke(this, column, new ObjectInfo[]{nextColumn});
    getBroadcastJava().addBefore(this, column);
    // setup hierarchy
    int index =
        nextColumn == null ? arrayInitializer.expressions().size() : getColumns().indexOf(
            nextColumn);
    addChild(column, nextColumn);
    // add source
    StatementTarget statementTarget =
        new StatementTarget(AstNodeUtils.getEnclosingStatement(columnsArray), true);
View Full Code Here

   * Moves existing {@link ColumnConfigInfo}.
   */
  public void command_MOVE(ColumnConfigInfo column, ColumnConfigInfo nextColumn) throws Exception {
    ArrayCreation columnsArray = getColumnsArray(true);
    Assert.isNotNull(columnsArray);
    ArrayInitializer arrayInitializer = columnsArray.getInitializer();
    JavaInfo oldParent = column.getParent() instanceof JavaInfo ? column.getParentJava() : null;
    int oldIndex = column.getParent().getChildren(ColumnConfigInfo.class).indexOf(column);
    int newIndex = getChildren(ColumnConfigInfo.class).indexOf(nextColumn);
    newIndex = newIndex == -1 ? arrayInitializer.expressions().size() : newIndex;
    // fire before event
    getBroadcastObject().childMoveBefore(getParent(), column, nextColumn);
    getBroadcastJava().moveBefore(column, oldParent, this);
    // move hierarchy
    if (column.getParent() == this && column.getAssociation() instanceof ArrayAssociation) {
View Full Code Here

        String name = attribute.getFullyQualifiedName();
        if ("groups".equals(name)) {
          Expression value = mvp.getValue();
          // Array?
          if (value instanceof ArrayInitializer) {
            ArrayInitializer ai = (ArrayInitializer) value;
            @SuppressWarnings("unchecked")
            List<Expression> expressions = ai.expressions();
            for (Expression e : expressions) {
              Object v = e.resolveConstantExpressionValue();
              String g = v != null ? v.toString() : e.toString();
              addGroup(g);
            }
View Full Code Here

TOP

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

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.