Package org.eclipse.jdt.core.dom

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


      void create(ColumnConfigInfo column, ColumnConfigInfo nextColumn) throws Exception {
        SimpleName columnsList = ensureColumnsList();
        ColumnConfigAssociation association = new ColumnConfigAssociation(columnsList);
        AssociationObject associationObject = new AssociationObject(association, true);
        if (nextColumn == null) {
          Statement columnsListUsageStatement = AstNodeUtils.getEnclosingStatement(columnsList);
          StatementTarget target = new StatementTarget(columnsListUsageStatement, true);
          JavaInfoUtils.addTarget(column, associationObject, GridInfo.this, target);
        } else {
          JavaInfoUtils.add(column, associationObject, GridInfo.this, nextColumn);
        }
      }

      @Override
      void move(ColumnConfigInfo column, ColumnConfigInfo nextColumn) throws Exception {
        SimpleName columnsList = ensureColumnsList();
        ColumnConfigAssociation association = new ColumnConfigAssociation(columnsList);
        AssociationObject associationObject = new AssociationObject(association, true);
        if (nextColumn == null) {
          Statement columnsListUsageStatement = AstNodeUtils.getEnclosingStatement(columnsList);
          StatementTarget target = new StatementTarget(columnsListUsageStatement, true);
          JavaInfoUtils.moveTarget(column, associationObject, GridInfo.this, null, target);
        } else {
          JavaInfoUtils.move(column, associationObject, GridInfo.this, nextColumn);
        }
      }

      SimpleName ensureColumnsList() throws Exception {
        ClassInstanceCreation columnModelCreation = getColumnModelCreation(true);
        // "columns" List usage in "ColumnModel" creation
        List<Expression> columnModelArguments = DomGenerics.arguments(columnModelCreation);
        Expression columnsList = columnModelArguments.get(0);
        if (columnsList instanceof SimpleName) {
          return (SimpleName) columnsList;
        }
        // if no columns then generate new ArrayList
        Statement columnModelStatement = AstNodeUtils.getEnclosingStatement(columnModelCreation);
        StatementTarget target = new StatementTarget(columnModelStatement, true);
        String configsName =
            getEditor().getUniqueVariableName(
                columnModelStatement.getStartPosition(),
                "configs",
                null);
        getEditor().addStatement(
            MessageFormat.format(
                "java.util.List<{0}> {1} = new java.util.ArrayList<{0}>();",
View Full Code Here


  private StatementTarget getTargetForNewItem(WidgetInfo item, WidgetInfo nextItem)
      throws Exception {
    StatementTarget target;
    if (nextItem == null) {
      Statement thisAssociationStatement = getAssociation().getStatement();
      target = new StatementTarget(thisAssociationStatement, true);
    } else {
      target = JavaInfoUtils.getTarget(this, item, nextItem);
    }
    return target;
View Full Code Here

    setInModelNoCompound(javaInfo);
  }

  @Override
  public void move(StatementTarget target) throws Exception {
    Statement statement = getStatement();
    m_editor.moveStatement(statement, target);
  }
View Full Code Here

    m_editor.moveStatement(statement, target);
  }

  @Override
  public boolean remove() throws Exception {
    Statement statement = getStatement();
    m_editor.removeEnclosingStatement(statement);
    // continue
    return super.remove();
  }
View Full Code Here

   */
  public boolean visit(Block node) {
    this.buffer.append("{\n");//$NON-NLS-1$
    this.indent++;
    for (Iterator it = node.statements().iterator(); it.hasNext(); ) {
      Statement s = (Statement) it.next();
      s.accept(this);
    }
    this.indent--;
    printIndent();
    this.buffer.append("}\n");//$NON-NLS-1$
    return false;
View Full Code Here

    node.getExpression().accept(this);
    this.buffer.append(") ");//$NON-NLS-1$
    this.buffer.append("{\n");//$NON-NLS-1$
    this.indent++;
    for (Iterator it = node.statements().iterator(); it.hasNext(); ) {
      Statement s = (Statement) it.next();
      s.accept(this);
      this.indent--; // incremented in visit(SwitchCase)
    }
    this.indent--;
    printIndent();
    this.buffer.append("}\n");//$NON-NLS-1$
View Full Code Here

                Iterator nodesIter = blockList.iterator();

                while (nodesIter.hasNext()) {
                    Block body = (Block) nodesIter.next();
                    AST ast = body.getAST();
                    Statement invocation = _createSetCheckpointInvocation(ast);
                    List<Statement> statements = body.statements();
                    statements.add(statements.size() - 2, invocation);
                    nodesIter.remove();
                }
            }
View Full Code Here

            superRestore.setName(ast
                    .newSimpleName(_getRestoreMethodName(false)));
            superRestore.arguments().add(ast.newSimpleName("timestamp"));
            superRestore.arguments().add(ast.newSimpleName("trim"));

            Statement superRestoreStatement = ast
                    .newExpressionStatement(superRestore);

            if ((parent != null)
                    && (state.getCrossAnalyzedTypes()
                            .contains(parent.getName()) || hasMethod(parent,
View Full Code Here

        }

        _openBrace();

        for (Iterator it = node.statements().iterator(); it.hasNext();) {
            Statement s = (Statement) it.next();
            s.accept(this);
        }

        _checkComments((node.getStartPosition() + node.getLength()) - 1);
        _closeBrace(newLineAfterBlock);
        _newLineAfterBlock = true;
View Full Code Here

     *
     *  @param node The AST node.
     *  @return Whether its children should be further visited.
     */
    public boolean visit(IfStatement node) {
        Statement thenStatement = node.getThenStatement();
        Statement elseStatement = node.getElseStatement();

        if (_indentIfStatement) {
            _output(_indent);
        } else {
            _indentIfStatement = true;
        }

        _output("if (");
        node.getExpression().accept(this);
        _output(")");

        if (thenStatement instanceof Block) {
            _output(" ");
            _newLineAfterBlock = elseStatement == null;
            node.getThenStatement().accept(this);
            _newLineAfterBlock = true;
        } else {
            _output("\n");
            _increaseIndent();
            node.getThenStatement().accept(this);
            _decreaseIndent();
        }

        if (elseStatement != null) {
            if (thenStatement instanceof Block) {
                _output(" ");
            } else {
                _output(_indent);
            }

            if (elseStatement instanceof Block) {
                _output("else ");
                elseStatement.accept(this);
            } else if (elseStatement instanceof IfStatement) {
                _indentIfStatement = false;
                _output("else ");
                elseStatement.accept(this);
            } else {
                _output("else\n");
                _increaseIndent();
                elseStatement.accept(this);
                _decreaseIndent();
            }
        }

        return false;
View Full Code Here

TOP

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

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.