Package org.eclipse.jdt.core.dom

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


      node.accept(visitor);
      break;
    }

    case ASTNode.CLASS_INSTANCE_CREATION: {
      final ClassInstanceCreation ctorCall = (ClassInstanceCreation) node;
      // if coming up from a argument.
      if (containedIn(ctorCall.arguments(), this.name))
        // if we don't have the source, no can do.
        if (!ctorCall.getType().resolveBinding().isFromSource())
          throw new DefinitelyNotEnumerizableException(
              Messages.ASTNodeProcessor_SourceNotPresent, node);
        else
          // go find the formals.
          this.findFormalsForVariable(ctorCall);
      break;
    }

    case ASTNode.CONSTRUCTOR_INVOCATION: {
      final ConstructorInvocation ctorCall = (ConstructorInvocation) node;
      // if coming up from a argument.
      if (containedIn(ctorCall.arguments(), this.name))
        // if we don't have the source, no can do.
        if (!ctorCall.resolveConstructorBinding().getDeclaringClass()
            .isFromSource())
          throw new DefinitelyNotEnumerizableException(
              Messages.ASTNodeProcessor_SourceNotPresent, node);
        else
          // go find the formals.
          this.findFormalsForVariable(ctorCall);
      break;
    }

    case ASTNode.SUPER_CONSTRUCTOR_INVOCATION: {
      final SuperConstructorInvocation ctorCall = (SuperConstructorInvocation) node;
      // if coming up from a argument.
      if (containedIn(ctorCall.arguments(), this.name))
        // if we don't have the source, no can do.
        if (!ctorCall.resolveConstructorBinding().getDeclaringClass()
            .isFromSource())
          throw new DefinitelyNotEnumerizableException(
              Messages.ASTNodeProcessor_SourceNotPresent, node);
        else
          // go find the formals.
View Full Code Here


     *
     * @param unresolvedMethodInvocation
     * @param calleeMethod
     */
    private void addAnonymousClass(UnresolvedMethodInvocation unresolvedMethodInvocation, FamixMethod calleeMethod) {
        ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) unresolvedMethodInvocation.getASTNode();
        // determine the anonymous class from the string
        FamixClass lDeclaringClass = null;
        ITypeBinding lTypeBinding = classInstanceCreation.resolveTypeBinding();
        if (lTypeBinding != null) {
            lDeclaringClass = unresolvedMethodInvocation.getInvocationHandler().getClass(lTypeBinding, null, true);
        } else {
            String lClassID = calleeMethod.getUniqueName();
            lClassID = lClassID.substring(0, lClassID.indexOf(AbstractFamixEntity.CONSTRUCTOR_PREFIX) - 1);
View Full Code Here

  protected void refresh_finish() throws Exception {
    super.refresh_finish();
    String cellTypeName = null;
    // if anonymous, then it was mocked as TextColumn
    if (getCreationSupport().getNode() instanceof ClassInstanceCreation) {
      ClassInstanceCreation creation = (ClassInstanceCreation) getCreationSupport().getNode();
      if (creation.getAnonymousClassDeclaration() != null) {
        ITypeBinding anonymousBinding = AstNodeUtils.getTypeBinding(creation);
        ITypeBinding superBinding = anonymousBinding.getSuperclass();
        String superName = AstNodeUtils.getFullyQualifiedName(superBinding, false);
        if ("com.google.gwt.user.cellview.client.Column".equals(superName)) {
          Expression cellExpression = DomGenerics.arguments(creation).get(0);
View Full Code Here

  private void createChildCellList() throws Exception {
    if (!(getCreationSupport() instanceof ConstructorCreationSupport)) {
      return;
    }
    // prepare expression
    ClassInstanceCreation creation =
        ((ConstructorCreationSupport) getCreationSupport()).getCreation();
    Expression cellListExpression = DomGenerics.arguments(creation).get(0);
    if (!AstNodeUtils.isSuccessorOf(
        AstNodeUtils.getTypeBinding(cellListExpression),
        "com.google.gwt.user.cellview.client.CellList")) {
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 =
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  public void openCommand() {
    if (getCreationSupport() instanceof ConstructorCreationSupport) {
      ConstructorCreationSupport creationSupport =
          (ConstructorCreationSupport) getCreationSupport();
      ClassInstanceCreation creation = creationSupport.getCreation();
      AbstractInvocationDescription description = creationSupport.getDescription();
      List<Expression> arguments = DomGenerics.arguments(creation);
      openCommand(description, arguments);
    }
    if (getCreationSupport() instanceof ImplicitFactoryCreationSupport) {
View Full Code Here

                  "\tpublic void execute() {",
                  "\t}",
                  "}"));
    }
    if (commandExpression instanceof ClassInstanceCreation) {
      ClassInstanceCreation newCommandExpression = (ClassInstanceCreation) commandExpression;
      AnonymousClassDeclaration classDeclaration =
          newCommandExpression.getAnonymousClassDeclaration();
      if (classDeclaration != null) {
        TypeDeclaration typeDeclaration = AnonymousTypeDeclaration.create(classDeclaration);
        return typeDeclaration.getMethods()[0];
      }
    }
View Full Code Here

   */
  private void addModelHTML(WidgetInfo component) throws Exception {
    InvocationChildAssociation association =
        (InvocationChildAssociation) component.getAssociation();
    MethodInvocation invocation = association.getInvocation();
    ClassInstanceCreation headerExpression =
        (ClassInstanceCreation) DomGenerics.arguments(invocation).get(1);
    WidgetInfo header =
        (WidgetInfo) JavaInfoUtils.createJavaInfo(
            getEditor(),
            "com.google.gwt.user.client.ui.HTML",
View Full Code Here

      Expression expression = m_property.getExpression();
      if (AstNodeUtils.isCreation(
          expression,
          "com.google.gwt.user.client.ui.Image",
          "<init>(java.lang.String)")) {
        ClassInstanceCreation creation = (ClassInstanceCreation) expression;
        Expression urlExpression = DomGenerics.arguments(creation).get(0);
        return JavaInfoEvaluationHelper.getValue(urlExpression);
      }
      return null;
    }
View Full Code Here

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

        ClassInstanceCreation primitiveTypeCreation = findPrimitiveTypeCreation(getASTNode(workingUnit,
                bug.getPrimarySourceLineAnnotation()));
        if (primitiveTypeCreation == null) {
            throw new BugResolutionException("Primitive type creation not found.");
        }
        MethodInvocation valueOfInvocation = createValueOfInvocation(rewrite, workingUnit, primitiveTypeCreation);
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.