Examples of ArrayCreation


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

            TypeAnalyzerState state, List fieldNames) {
        VariableDeclarationFragment fragment = ast
                .newVariableDeclarationFragment();
        fragment.setName(ast.newSimpleName(RECORDS_NAME));

        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();
View Full Code Here

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

      this.process(node.getParent());
      break;
    }

    case ASTNode.ARRAY_CREATION: {
      final ArrayCreation creation = (ArrayCreation) node;
      boolean legal = true;
      for (final Iterator it = creation.dimensions().iterator(); it
          .hasNext();) {
        final Expression dimension = (Expression) it.next();
        // if coming up from the index.
        if (containedIn(dimension, this.name)) {
          legal = false;
View Full Code Here

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

      this.processExpression(access.getArray());
      break;
    }

    case ASTNode.ARRAY_CREATION: {
      final ArrayCreation creation = (ArrayCreation) node;
      this.processExpression(creation.getInitializer());
      break;
    }

    case ASTNode.ARRAY_INITIALIZER: {
      final ArrayInitializer init = (ArrayInitializer) node;
View Full Code Here

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

  //
  // Binds (on parse)
  //
  ////////////////////////////////////////////////////////////////////////////
  private void bindColumns(List<JavaInfo> javaInfoList) throws Exception {
    ArrayCreation columnsArray = getColumnsArray(false);
    if (columnsArray == null) {
      return;
    }
    @SuppressWarnings("unchecked")
    List<Expression> arrayExpressions = columnsArray.getInitializer().expressions();
    // check ColumnConfig-s
    for (JavaInfo javaInfo : javaInfoList) {
      if (javaInfo instanceof ColumnConfigInfo && javaInfo.getParent() == null) {
        ColumnConfigInfo column = (ColumnConfigInfo) javaInfo;
        for (Expression arrayExpression : arrayExpressions) {
View Full Code Here

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

  ////////////////////////////////////////////////////////////////////////////
  /**
   * 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 =
View Full Code Here

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

  /**
   * 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
View Full Code Here

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

    AstEditor editor = containerInfo.getEditor();
    MethodInvocation methodInvocation =
        containerInfo.addMethodInvocation(methodName + "(" + itemClassName + "[])", "new "
            + itemClassName
            + "[] { }");
    ArrayCreation arrayCreation = (ArrayCreation) DomGenerics.arguments(methodInvocation).get(0);
    Class<?> itemClass =
        ReflectionUtils.getClassByName(EditorState.get(editor).getEditorLoader(), itemClassName);
    // create "arrayInfo"
    ArrayObjectInfo arrayInfo = new ArrayObjectInfo(editor, methodName, itemClass, arrayCreation);
    containerInfo.addChild(arrayInfo);
View Full Code Here

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

    if (type.isArrayType()) {
      final ICPPASTArrayDeclarator arrayDeclarator = f.newArrayDeclarator(new NameInfo(variableDeclaration.getName()).getName());
      arrayDeclarator.addPointerOperator(f.newPointer());
      if (variableDeclaration.getInitializer() != null) {
        final ArrayCreation arrayCreation = (ArrayCreation) variableDeclaration.getInitializer();
        for (final Object dimensionObject : arrayCreation.dimensions()) {
          final ExpressionInfo dimension = new ExpressionInfo((Expression) dimensionObject, null, compilationUnitInfo);
          arrayDeclarator.addArrayModifier(f.newArrayModifier(dimension.getExpression()));
        }
      } else {
        final ArrayType arrayType = (ArrayType) type;
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.nodes.ArrayCreation

    String expected = "<?php array (1, 2, 3) ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        ExpressionStatement statement = (ExpressionStatement) program
            .statements().get(0);
        ArrayCreation expression = (ArrayCreation) statement
            .getExpression();
        /* ArrayElement arrayElement = */expression.elements()
            .remove(0);
      }
    });
  }
 
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.nodes.ArrayCreation

    String expected = "<?php array (0, 1, 2) ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        ExpressionStatement statement = (ExpressionStatement) program
            .statements().get(0);
        ArrayCreation expression = (ArrayCreation) statement
            .getExpression();
        /* ArrayElement arrayElement = */expression.elements()
            .remove(3);
      }
    });
  }
 
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.