Example usage for org.eclipse.jdt.core.dom SuperConstructorInvocation setExpression

List of usage examples for org.eclipse.jdt.core.dom SuperConstructorInvocation setExpression

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperConstructorInvocation setExpression.

Prototype

public void setExpression(Expression expression) 

Source Link

Document

Sets or clears the expression of this super constructor invocation statement.

Usage

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.SuperConstructorInvocation node) {
    SuperConstructorInvocation element = (SuperConstructorInvocation) this.binding.get(node);
    this.initializeNode(element, node);

    if (this.binding.get(node.getExpression()) != null)
        element.setExpression((Expression) this.binding.get(node.getExpression()));
    for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) {
        Expression itElement = (Expression) this.binding.get(i.next());
        if (itElement != null)
            element.getArguments().add(itElement);
    }/*from  ww w  . j a  va2  s  . com*/
    NamedElementRef constructorRef = this.factory.createNamedElementRef();
    element.setMethod(constructorRef);
    JDTVisitorUtils.manageBindingRef(constructorRef, node, this);

}

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public Statement convert(org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall statement) {
    Statement newStatement;/*  w  w  w .j a  v a2 s .  c  om*/
    int sourceStart = statement.sourceStart;
    if (statement.isSuperAccess() || statement.isSuper()) {
        SuperConstructorInvocation superConstructorInvocation = new SuperConstructorInvocation(this.ast);
        if (statement.qualification != null) {
            superConstructorInvocation.setExpression(convert(statement.qualification));
        }
        org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
        if (arguments != null) {
            int length = arguments.length;
            for (int i = 0; i < length; i++) {
                superConstructorInvocation.arguments().add(convert(arguments[i]));
            }
        }
        if (statement.typeArguments != null) {
            if (sourceStart > statement.typeArgumentsSourceStart) {
                sourceStart = statement.typeArgumentsSourceStart;
            }
            switch (this.ast.apiLevel) {
            case AST.JLS2_INTERNAL:
                superConstructorInvocation.setFlags(superConstructorInvocation.getFlags() | ASTNode.MALFORMED);
                break;
            default:
                for (int i = 0, max = statement.typeArguments.length; i < max; i++) {
                    superConstructorInvocation.typeArguments().add(convertType(statement.typeArguments[i]));
                }
                break;
            }
        }
        newStatement = superConstructorInvocation;
    } else {
        ConstructorInvocation constructorInvocation = new ConstructorInvocation(this.ast);
        org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
        if (arguments != null) {
            int length = arguments.length;
            for (int i = 0; i < length; i++) {
                constructorInvocation.arguments().add(convert(arguments[i]));
            }
        }
        if (statement.typeArguments != null) {
            if (sourceStart > statement.typeArgumentsSourceStart) {
                sourceStart = statement.typeArgumentsSourceStart;
            }
            switch (this.ast.apiLevel) {
            case AST.JLS2_INTERNAL:
                constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
                break;
            default:
                for (int i = 0, max = statement.typeArguments.length; i < max; i++) {
                    constructorInvocation.typeArguments().add(convertType(statement.typeArguments[i]));
                }
                break;
            }
        }
        if (statement.qualification != null) {
            // this is an error
            constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
        }
        newStatement = constructorInvocation;
    }
    newStatement.setSourceRange(sourceStart, statement.sourceEnd - sourceStart + 1);
    if (this.resolveBindings) {
        recordNodes(newStatement, statement);
    }
    return newStatement;
}

From source file:org.eclipse.modisco.java.discoverer.internal.io.java.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(final org.eclipse.jdt.core.dom.SuperConstructorInvocation node) {
    SuperConstructorInvocation element = (SuperConstructorInvocation) this.binding.get(node);
    initializeNode(element, node);//  w w  w .  j  a v  a  2 s .  c  o  m

    if (this.binding.get(node.getExpression()) != null) {
        element.setExpression(JDTVisitorUtils.completeExpression(this.binding.get(node.getExpression()), this));
    }

    for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) {
        ASTNode itElement = this.binding.get(i.next());
        if (itElement != null) {
            element.getArguments().add(JDTVisitorUtils.completeExpression(itElement, this));
        }
    }

    for (Iterator<?> i = node.typeArguments().iterator(); i.hasNext();) {
        ASTNode itElement = this.binding.get(i.next());
        if (itElement != null) {
            element.getTypeArguments().add(JDTVisitorUtils.completeTypeAccess(itElement, this));
        }
    }

    PendingElement constructorRef = new PendingElement(this.factory);
    constructorRef.setClientNode(element);
    constructorRef.setLinkName("method"); //$NON-NLS-1$

    JDTVisitorUtils.manageBindingRef(constructorRef, node, this);
}

From source file:org.whole.lang.java.util.JDTTransformerVisitor.java

License:Open Source License

public boolean visit(SuperConstructorInvocation node) {
    org.whole.lang.java.model.SuperConstructorInvocation superCall = lf
            .create(JavaEntityDescriptorEnum.SuperConstructorInvocation);

    if (acceptChild(node.getExpression()))
        superCall.setExpression(exp);

    setTypeArguments(superCall.getTypeArguments(), node.typeArguments());

    Arguments arguments;/*from w  ww.j  a  v a 2 s.  c  o  m*/
    superCall.setArguments(arguments = lf.create(JavaEntityDescriptorEnum.Arguments));
    Iterator<?> i = node.arguments().iterator();
    while (i.hasNext()) {
        ((ASTNode) i.next()).accept(this);
        arguments.wAdd(exp);
    }

    stm = superCall;
    return false;
}