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

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

Introduction

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

Prototype

public final ASTNode getParent() 

Source Link

Document

Returns this node's parent node, or null if this is the root node.

Usage

From source file:egovframework.mgt.fit.library.parser.visitor.StatementParsingVisitor.java

License:Apache License

/**
 * ? ? ? ?  ? ./* w  w w .  j  a  v  a  2 s. c o m*/
 * @return   
 */
@Override
public boolean visit(SuperConstructorInvocation node) {
    if (node.getParent().getNodeType() == parentType) {
        addSingleStatement(node.toString(), StatementLine.SUPERCONSTRUCTOR);
    }
    return super.visit(node);
}

From source file:net.sf.j2s.core.astvisitors.ASTScriptVisitor.java

License:Open Source License

public boolean visit(SuperConstructorInvocation node) {
    IMethodBinding constructorBinding = node.resolveConstructorBinding();
    if (constructorBinding == null) {
        return false;
    }/*  w  w  w .j  ava2 s.c  om*/
    ITypeBinding declaringClass = constructorBinding.getDeclaringClass();
    if ("java.lang.Object".equals(declaringClass.getQualifiedName())) {
        return false;
    }
    ASTNode parent = node.getParent();
    if (parent instanceof Block) {
        Block methoBlock = (Block) parent;
        ASTNode methodParent = methoBlock.getParent();
        if (methodParent instanceof MethodDeclaration) {
            MethodDeclaration method = (MethodDeclaration) methodParent;
            if (getJ2STag(method, "@j2sIgnoreSuperConstructor") != null) {
                return false;
            }
        }
    }
    /*
     * TODO: expression before the "super" should be considered.
     */
    buffer.append("Clazz.superConstructor (this, ");
    buffer.append(assureQualifiedName(shortenQualifiedName(getFullClassName())));
    IMethodBinding methodDeclaration = null;
    if (constructorBinding != null) {
        methodDeclaration = constructorBinding.getMethodDeclaration();
    }
    visitMethodParameterList(node.arguments(), methodDeclaration, true, ", [", "]");
    buffer.append(");\r\n");
    return false;
}