Package org.eclipse.jdt.core.dom

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


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

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

            if (!(s instanceof SwitchCase)) {
                _increaseIndent();
            }

            s.accept(this);

            if (!(s instanceof SwitchCase)) {
                _decreaseIndent();
            }
        }
View Full Code Here


             
              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

  //
  // Utils
  //
  ////////////////////////////////////////////////////////////////////////////
  private static StatementTarget getNewConstraintsTarget(WidgetInfo widget) {
    Statement associationStatement = widget.getAssociation().getStatement();
    return new StatementTarget(associationStatement, false);
  }
View Full Code Here

            m_panel.addMethodInvocation(target, m_methodSignature, arguments);
          }
        }

        private StatementTarget getTarget(JavaInfo javaInfo) {
          Statement targetStatement = javaInfo.getAssociation().getStatement();
          return new StatementTarget(targetStatement, false);
        }
      });
      return true;
    }
View Full Code Here

    // if no location set yet, add setWidgetPosition()
    if (!locationSet) {
      // prepare target (after association)
      StatementTarget target;
      {
        Statement associationStatement = widget.getAssociation().getStatement();
        target = new StatementTarget(associationStatement, false);
      }
      // add invocation
      String source = TemplateUtils.format("{0}.setWidgetPosition({1}{2})", this, widget, xyString);
      Expression expression = widget.addExpressionStatement(target, source);
View Full Code Here

  }

  private void addNewSubMenu() throws Exception {
    ConstructorCreationSupport creationSupport = (ConstructorCreationSupport) getCreationSupport();
    ClassInstanceCreation creation = creationSupport.getCreation();
    Statement creationStatement = AstNodeUtils.getEnclosingStatement(creation);
    for (ParameterDescription parameter : creationSupport.getDescription().getParameters()) {
      if (parameter.hasTrueTag("MenuBar.subMenu")) {
        // create "vertical" MenuBar
        MenuBarInfo subMenu =
            (MenuBarInfo) JavaInfoUtils.createJavaInfo(
View Full Code Here

            JavaInfoEvaluationHelper.setValue(arguments.get(1), location.x);
          }
        }

        private StatementTarget getTarget() {
          Statement targetStatement = javaInfo.getAssociation().getStatement();
          return new StatementTarget(targetStatement, false);
        }
      });
      return true;
    }
View Full Code Here

    protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
        assert rewrite != null;
        assert workingUnit != null;
        assert bug != null;

        Statement statement = findUselessStatement(getASTNode(workingUnit, bug.getPrimarySourceLineAnnotation()));
        rewrite.remove(statement, null);
    }
View Full Code Here

    public static Statement getStatement(CompilationUnit compilationUnit, MethodDeclaration method, int startLine, int endLine)
            throws StatementNotFoundException {
        checkForNull(compilationUnit, "compilation unit");
        checkForNull(method, "method declaration");

        Statement statement = searchStatement(compilationUnit, method.getBody().statements(), startLine, endLine);
        if (statement == null) {
            throw new StatementNotFoundException(compilationUnit, startLine, endLine);
        }
        return statement;
    }
View Full Code Here

    protected static Statement searchStatement(CompilationUnit compilationUnit, List<?> statements, int startLine, int endLine) {
        assert compilationUnit != null;
        assert statements != null;

        for (Object statementObj : statements) {
            Statement statement = (Statement) statementObj;
            int lineNumber = compilationUnit.getLineNumber(statement.getStartPosition());
            if (startLine <= lineNumber && lineNumber <= endLine) {
                return statement;
            }
        }
        return null;
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.