Example usage for org.eclipse.jdt.internal.compiler.ast ConstructorDeclaration isConstructor

List of usage examples for org.eclipse.jdt.internal.compiler.ast ConstructorDeclaration isConstructor

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast ConstructorDeclaration isConstructor.

Prototype

@Override
    public boolean isConstructor() 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.ConstructorLocator.java

License:Open Source License

public SearchMatch newDeclarationMatch(ASTNode reference, IJavaElement element, Binding binding, int accuracy,
        int length, MatchLocator locator) {
    this.match = null;
    int offset = reference.sourceStart;
    if (this.pattern.findReferences) {
        if (reference instanceof TypeDeclaration) {
            TypeDeclaration type = (TypeDeclaration) reference;
            AbstractMethodDeclaration[] methods = type.methods;
            if (methods != null) {
                for (int i = 0, max = methods.length; i < max; i++) {
                    AbstractMethodDeclaration method = methods[i];
                    boolean synthetic = method.isDefaultConstructor() && method.sourceStart < type.bodyStart;
                    this.match = locator.newMethodReferenceMatch(element, binding, accuracy, offset, length,
                            method.isConstructor(), synthetic, method);
                }/*  w ww . j  a  va2  s.com*/
            }
        } else if (reference instanceof ConstructorDeclaration) {
            ConstructorDeclaration constructor = (ConstructorDeclaration) reference;
            ExplicitConstructorCall call = constructor.constructorCall;
            boolean synthetic = call != null && call.isImplicitSuper();
            this.match = locator.newMethodReferenceMatch(element, binding, accuracy, offset, length,
                    constructor.isConstructor(), synthetic, constructor);
        }
    }
    if (this.match != null) {
        return this.match;
    }
    // super implementation...
    return locator.newDeclarationMatch(element, binding, accuracy, reference.sourceStart, length);
}