Package org.eclipse.jdt.core.dom

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


    }
    return success;
  }

  private boolean processWidgetCreationStatement(TypeDeclaration type, WidgetAdapter adapter, EventSetDescriptor esd, MethodDescriptor mListener, Statement statement) {
    ExpressionStatement expressionStatement = (ExpressionStatement) statement;
    Expression expression = expressionStatement.getExpression();
    if (expression instanceof MethodInvocation) {
      MethodInvocation mi = (MethodInvocation) expression;
      if (adapter.isRoot()) {
        return createAddMethod(type, adapter, esd, mListener, mi);
      } else {
View Full Code Here


  public void parse(String lnfClassname, TypeDeclaration type) {
    List statements = getBeanPropertyInitStatements(adaptable, type);
    for (Object stmt : statements) {
      Statement statement = (Statement) stmt;
      if (statement instanceof ExpressionStatement) {
        ExpressionStatement es = (ExpressionStatement) statement;
        Expression expression = es.getExpression();
        if (expression instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) expression;
          Expression optional = mi.getExpression();
          if (isShouldCheck(optional)) {
            String mName = mi.getName().getFullyQualifiedName();
View Full Code Here

  protected IEventMethod getDelegatingContent(WidgetAdapter adapter, EventSetDescriptor eventSet, MethodDescriptor methodDesc, Block body, SingleVariableDeclaration var) {
    List statements = body.statements();
    if (statements.size() == 1) {
      Object stmt = statements.get(0);
      if (stmt instanceof ExpressionStatement) {
        ExpressionStatement es = (ExpressionStatement) stmt;
        Expression expression = es.getExpression();
        if (expression instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) expression;
          Expression optional = mi.getExpression();
          if (optional == null||optional instanceof ThisExpression) {
            List list = mi.arguments();
            if (list.size() != 1) {
              return new CodeSnippet(adapter, eventSet, methodDesc, es.toString());
            }
            Expression exp = (Expression) list.get(0);
            if (exp instanceof SimpleName) {
              SimpleName sn = (SimpleName) exp;
              SimpleName varn = var.getName();
              if (sn.getFullyQualifiedName().equals(varn.getFullyQualifiedName()))
                return new EventDelegation(methodDesc, mi.getName().getFullyQualifiedName());
            }
            return new CodeSnippet(adapter, eventSet, methodDesc, es.toString());
          } else {
            return new CodeSnippet(adapter, eventSet, methodDesc, es.toString());
          }
        } else
          return new CodeSnippet(adapter, eventSet, methodDesc, es.toString());
      } else
        return new CodeSnippet(adapter, eventSet, methodDesc, stmt.toString());
    } else {
      StringBuilder builder = new StringBuilder();
      for (Object stmt : statements) {
View Full Code Here

public class ExpressionStatementEvaluatorFactory extends ASTEvaluatorFactory {

  @Override
  protected IEvaluator createEvaluator(Object adaptable) {
    if(adaptable instanceof ExpressionStatement){
      ExpressionStatement expStmt = (ExpressionStatement) adaptable;
      return new ExpressionStatementEvaluator(expStmt);
    }
    return null;
  }
View Full Code Here

    String m_source = m_columns.getIdentifier() + ".add(%child%)";
    {
      // add new statement
      String source = AssociationUtils.replaceTemplates(javaInfo, m_source, target);
      List<String> lines = GenericsUtils.asList(leadingComments, source + ";");
      ExpressionStatement statement =
          (ExpressionStatement) javaInfo.getEditor().addStatement(lines, target);
      m_invocation = (MethodInvocation) statement.getExpression();
    }
    // add related nodes
    AbstractInsideStatementGenerator.addRelatedNodes(javaInfo, m_invocation);
    // set association
    setInModelNoCompound(javaInfo);
View Full Code Here

        MethodDeclaration method = getMethodDeclaration(type, bug.getPrimaryMethod());

        AST ast = rewrite.getAST();

        SuperMethodInvocation superCall = createSuperMethodInvocation(rewrite, method);
        ExpressionStatement statement = ast.newExpressionStatement(superCall);
        Block methodBody = method.getBody();
        ListRewrite listRewrite = rewrite.getListRewrite(methodBody, Block.STATEMENTS_PROPERTY);
        if (isInsertFirst()) {
            listRewrite.insertFirst(statement, null);
        } else {
View Full Code Here

        StringLiteral literal = ast.newStringLiteral();
        literal.setLiteralValue(thePropertyKey);
        methodInvocation.arguments().add(literal);
        methodInvocation.arguments().add(paramName.copySubtree(newMethod.getAST(), paramName));
       
        ExpressionStatement expressionStatement = ast.newExpressionStatement(methodInvocation);
        block.statements().add(expressionStatement);
         
        newMethod.setBody(block); // add the block to the method
        newType.bodyDeclarations().add(newMethod); //add the method to the type
       
View Full Code Here

      String getterName = "get" + propertyName;
      paramInvocation.setName(ast.newSimpleName(getterName));
     
      methodInvocation.arguments().add(paramInvocation);
     
      ExpressionStatement expressionStatement = ast.newExpressionStatement(methodInvocation);
      block.statements().add(expressionStatement);

     
    }
    /*
 
View Full Code Here

        // Set the timestamp as the next argument.
        recordInvocation.arguments().add(timestampGetter);

        // The statement of the method call.
        ExpressionStatement recordStatement = ast
                .newExpressionStatement(recordInvocation);
        thenBranch.statements().add(recordStatement);

        ifStatement.setThenStatement(thenBranch);
        block.statements().add(ifStatement);
View Full Code Here

            // Assign the new checkpoint.
            Assignment assignment = ast.newAssignment();
            assignment.setLeftHandSide(ast.newSimpleName(CHECKPOINT_NAME));
            assignment.setRightHandSide(ast.newSimpleName("checkpoint"));

            ExpressionStatement statement = ast
                    .newExpressionStatement(assignment);
            thenBranch.statements().add(statement);

            // Propagate the change to other objects monitored by the same old
            // checkpoint.
View Full Code Here

TOP

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

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.