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

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

Introduction

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

Prototype

public final int getStartPosition() 

Source Link

Document

Returns the character index into the original source file indicating where the source fragment corresponding to this node begins.

Usage

From source file:br.uff.ic.gems.resources.ast.Visitor.java

@Override
public boolean visit(SuperConstructorInvocation node) {
    int beginLine = cu.getLineNumber(node.getStartPosition());
    int endLine = cu.getLineNumber(node.getStartPosition() + node.getLength());
    int beginColumn = cu.getColumnNumber(node.getStartPosition());
    int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength());

    languageConstructs.add(//from   ww  w .ja v  a  2s  .  com
            new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn));

    return true;
}

From source file:ca.uvic.chisel.javasketch.internal.ast.ASTMessageFinder.java

License:Open Source License

public boolean visit(SuperConstructorInvocation node) {
    if (!(message instanceof ICall))
        return false;
    if (containsMessage(node)) {
        ICall call = (ICall) message;/*from w  w w  .  j a va 2s .  co  m*/
        IMethodBinding binding = node.resolveConstructorBinding();
        if (binding != null) {
            binding = binding.getMethodDeclaration();
            if (binding != null) {
                IJavaElement element = binding.getJavaElement();
                if (element instanceof IMethod) {
                    try {
                        IMethod jm = (IMethod) element;
                        //get the target method.
                        ITraceClassMethod am = call.getTarget().getActivation().getMethod();
                        if (JavaSearchUtils.getFullyQualifiedName(jm.getDeclaringType(), true)
                                .equals(am.getTraceClass().getName())) {
                            String types[] = Signature.getParameterTypes(am.getSignature());
                            IMethod testMethod = jm.getDeclaringType().getMethod(am.getName(), types);
                            if (jm.isSimilar(testMethod)) {
                                this.node = node;
                                try {
                                    if (document
                                            .getLineOfOffset(node.getStartPosition()) != (call.codeLine() - 1))
                                        //look for a better match.
                                        return true;
                                } catch (BadLocationException e) {
                                }
                                return false;
                            }
                        }
                    } catch (NullPointerException e) {
                        return false;
                    }
                }
            }
        }
        return true;
    }

    return false;
}

From source file:org.bundlemaker.core.ui.editor.sourceviewer.referencedetail.JdtAstVisitor.java

License:Open Source License

@Override
public boolean visit(SuperConstructorInvocation node) {

    // TODO: Zusammenlegen mit ConstructorInvocation

    IMethodBinding methodBinding = node.resolveConstructorBinding();

    // resolve type arguments
    ITypeBinding[] parameterTypes = methodBinding.getParameterTypes();
    for (ITypeBinding typeBinding : parameterTypes) {
        resolveTypeBinding(typeBinding, node.getStartPosition(), node.getLength());
    }/*from ww w .ja  v  a2 s. c o m*/

    // List<Expression> typeArguments = node.arguments();
    // for (Expression expression : typeArguments) {
    // resolveTypeBinding(expression.resolveTypeBinding(), node
    // .getStartPosition(), node.getLength());
    // }

    // visit the child nodes
    return true;

}