Package org.eclipse.jdt.core.dom

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


    CodeReviewResource resource = getCurrentResource(history);
    List<?> list = resource.getTypedNodeList(resource.getResourceCompUnit(),
        ASTNode.CLASS_INSTANCE_CREATION, true);
   
    for (Object obj : list) {
      ClassInstanceCreation creation = (ClassInstanceCreation) obj;
      Type type = creation.getType();
     
      if (type != null) {
        ITypeBinding binding = type.resolveBinding();
        String compName = mappingHelper.getComponentName(binding);
        if (compName != null) {
View Full Code Here


          }
        }
       
        fields = resource.getTypedNodeList(node, ASTNode.CLASS_INSTANCE_CREATION, true);
        for (Object classCreationObj : fields) {
          ClassInstanceCreation classCreation = (ClassInstanceCreation) classCreationObj;
          if (classCreation.getType() != null) {
            addAllIncludedTypes(classCreation.getType(), allReferences);
          }
        }
       
       
        for (ITypeBinding binding : allReferences.getTypeReferences()) {
View Full Code Here

    Block body = ast.newBlock();
    input.setBody(body);

    SimpleName uoe = ast.newSimpleName("UnsupportedOperationException");
    SimpleType uoeType = ast.newSimpleType(uoe);
    ClassInstanceCreation newUoeType = ast.newClassInstanceCreation();
    newUoeType.setType(uoeType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newUoeType);
    body.statements().add(statement);
View Full Code Here

    Block body = ast.newBlock();
    input.setBody(body);

    SimpleName uoe = ast.newSimpleName("UnsupportedOperationException");
    SimpleType uoeType = ast.newSimpleType(uoe);
    ClassInstanceCreation newUoeType = ast.newClassInstanceCreation();
    newUoeType.setType(uoeType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newUoeType);
    body.statements().add(statement);
View Full Code Here

  }

  private Expression getConstructorMethodInvocationExpression(
      String methodId, String classId) {
    Expression result = null;
    ClassInstanceCreation instExpr = ast.newClassInstanceCreation();
    instExpr.setType(ast.newSimpleType(ast.newSimpleName(classId)));

    Expression parameter = createParameter(methodId);

    SimpleName methodName = ast.newSimpleName(methodId.toLowerCase());
View Full Code Here

  private Expression getConstructorFieldInvocationExpression(String fieldId,
      String classId) {
    Expression result = null;

    ClassInstanceCreation instExpr = ast.newClassInstanceCreation();
    instExpr.setType(ast.newSimpleType(ast.newSimpleName(classId)));
    FieldAccess fieldAcc = ast.newFieldAccess();
    fieldAcc.setExpression(instExpr);
    fieldAcc.setName(ast.newSimpleName(fieldId.toLowerCase()));
    result = fieldAcc;
    return result;
View Full Code Here

  }

  @Override
  @SuppressWarnings("unchecked")
  protected List<Expression> getArguments(Expression invocationExpression) {
    ClassInstanceCreation methodInvocation = (ClassInstanceCreation) invocationExpression;
    List<Expression> arguments = new ArrayList<Expression>();
    for (Iterator<Expression> argumentIter = methodInvocation.arguments().iterator(); argumentIter.hasNext();) {
      Expression argumentExpression = argumentIter.next();
      arguments.add(argumentExpression);
    }
    return arguments;
  }
View Full Code Here

    }

    ITypeBinding typeBinding = QuickfixUtils.getTargetTypeBinding(javaProject, targetType);

    String className = targetType.getFullyQualifiedName();
    ClassInstanceCreation invocationNode = QuickfixUtils.getMockConstructorInvocation(className,
        constructorArgClassNames.toArray(new String[constructorArgClassNames.size()]));
    List<Expression> arguments = QuickfixUtils.getArguments(invocationNode);
    Object constructorProposal = QuickfixReflectionUtils.createNewMethodProposal(targetType.getElementName(), cu,
        invocationNode, arguments, typeBinding, 0, null);
    QuickfixReflectionUtils.applyProposal(constructorProposal, document);
View Full Code Here

      paramTypes[i] = "Object";
    }

    IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
    if (methodBinding != null) {
      ClassInstanceCreation invocationNode = QuickfixUtils.getMockConstructorInvocation(constructor
          .getDeclaringType().getFullyQualifiedName(), paramTypes);
      Object proposal = QuickfixReflectionUtils.createChangeMethodSignatureProposal(label, targetCU,
          invocationNode, methodBinding, changeDesc, 5, getImage());
      QuickfixReflectionUtils.applyProposal(proposal, document);
    }
View Full Code Here

        paramTypes[i] = "Object";
      }

      IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
      if (methodBinding != null) {
        ClassInstanceCreation invocationNode = QuickfixUtils.getMockConstructorInvocation(constructor
            .getDeclaringType().getFullyQualifiedName(), paramTypes);
        Object proposal = QuickfixReflectionUtils.createChangeMethodSignatureProposal(label, targetCU,
            invocationNode, methodBinding, changeDesc, 5, getImage());
        QuickfixReflectionUtils.applyProposal(proposal, document);
      }
View Full Code Here

TOP

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

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.