Example usage for org.eclipse.jdt.internal.compiler.ast ASTNode InsideJavadoc

List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode InsideJavadoc

Introduction

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

Prototype

int InsideJavadoc

To view the source code for org.eclipse.jdt.internal.compiler.ast ASTNode InsideJavadoc.

Click Source Link

Usage

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

License:Open Source License

/**
 * Special case for message send in javadoc comment. They can be in fact bound to a contructor.
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=83285"
 */// w w  w. j  a  v a 2  s  . co  m
public int match(MessageSend msgSend, MatchingNodeSet nodeSet) {
    if ((msgSend.bits & ASTNode.InsideJavadoc) == 0)
        return IMPOSSIBLE_MATCH;
    if (this.pattern.declaringSimpleName == null
            || CharOperation.equals(msgSend.selector, this.pattern.declaringSimpleName)) {
        return nodeSet.addMatch(msgSend, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
    }
    return IMPOSSIBLE_MATCH;
}

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

License:Open Source License

boolean matchParametersCount(ASTNode node, Expression[] args) {
    if (this.pattern.parameterSimpleNames != null
            && (!this.pattern.varargs || ((node.bits & ASTNode.InsideJavadoc) != 0))) {
        int length = this.pattern.parameterCount;
        if (length < 0)
            length = this.pattern.parameterSimpleNames.length;
        int argsLength = args == null ? 0 : args.length;
        if (length != argsLength) {
            return false;
        }/*from   w  w  w.j  a  v  a2s . c  om*/
    }
    return true;
}

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

License:Open Source License

public FieldReferenceMatch newFieldReferenceMatch(IJavaElement enclosingElement, IJavaElement localElement,
        Binding enclosingBinding, int accuracy, int offset, int length, ASTNode reference) {
    int bits = reference.bits;
    boolean isCompoundAssigned = (bits & ASTNode.IsCompoundAssigned) != 0;
    boolean isReadAccess = isCompoundAssigned || (bits & ASTNode.IsStrictlyAssigned) == 0;
    boolean isWriteAccess = isCompoundAssigned || (bits & ASTNode.IsStrictlyAssigned) != 0;
    if (isWriteAccess) {
        if (reference instanceof QualifiedNameReference) {
            char[][] tokens = ((QualifiedNameReference) reference).tokens;
            char[] lastToken = tokens[tokens.length - 1];
            if (this.pattern instanceof OrPattern) {
                SearchPattern[] patterns = ((OrPattern) this.pattern).patterns;
                for (int i = 0, pLength = patterns.length; i < pLength; i++) {
                    if (!this.patternLocator.matchesName(((VariablePattern) patterns[i]).name, lastToken)) {
                        isWriteAccess = false;
                        isReadAccess = true;
                    }//from  ww  w.  ja  v  a  2s.c  o m
                }
            } else if (!this.patternLocator.matchesName(((VariablePattern) this.pattern).name, lastToken)) {
                isWriteAccess = false;
                isReadAccess = true;
            }
        }
    }
    boolean insideDocComment = (bits & ASTNode.InsideJavadoc) != 0;
    SearchParticipant participant = getParticipant();
    IResource resource = this.currentPossibleMatch.resource;
    if (enclosingBinding != null) {
        enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
    }
    FieldReferenceMatch match = new FieldReferenceMatch(enclosingElement, accuracy, offset, length,
            isReadAccess, isWriteAccess, insideDocComment, participant, resource);
    match.setLocalElement(localElement);
    return match;
}

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

License:Open Source License

public SearchMatch newLocalVariableReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset,
        int length, ASTNode reference) {
    int bits = reference.bits;
    boolean isCompoundAssigned = (bits & ASTNode.IsCompoundAssigned) != 0;
    boolean isReadAccess = isCompoundAssigned || (bits & ASTNode.IsStrictlyAssigned) == 0;
    boolean isWriteAccess = isCompoundAssigned || (bits & ASTNode.IsStrictlyAssigned) != 0;
    if (isWriteAccess) {
        if (reference instanceof QualifiedNameReference) {
            char[][] tokens = ((QualifiedNameReference) reference).tokens;
            char[] lastToken = tokens[tokens.length - 1];
            if (this.pattern instanceof OrPattern) {
                SearchPattern[] patterns = ((OrPattern) this.pattern).patterns;
                for (int i = 0, pLength = patterns.length; i < pLength; i++) {
                    if (!this.patternLocator.matchesName(((VariablePattern) patterns[i]).name, lastToken)) {
                        isWriteAccess = false;
                        isReadAccess = true;
                    }/*ww w  . j av  a 2 s  .c  o  m*/
                }
            } else if (!this.patternLocator.matchesName(((VariablePattern) this.pattern).name, lastToken)) {
                isWriteAccess = false;
                isReadAccess = true;
            }
        }
    }
    boolean insideDocComment = (bits & ASTNode.InsideJavadoc) != 0;
    SearchParticipant participant = getParticipant();
    IResource resource = this.currentPossibleMatch.resource;
    return new LocalVariableReferenceMatch(enclosingElement, accuracy, offset, length, isReadAccess,
            isWriteAccess, insideDocComment, participant, resource);
}

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

License:Open Source License

public MethodReferenceMatch newMethodReferenceMatch(IJavaElement enclosingElement, Binding enclosingBinding,
        int accuracy, int offset, int length, boolean isConstructor, boolean isSynthetic, ASTNode reference) {
    SearchParticipant participant = getParticipant();
    IResource resource = this.currentPossibleMatch.resource;
    boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0;
    if (enclosingBinding != null)
        enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
    boolean isOverridden = (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0;
    return new MethodReferenceMatch(enclosingElement, accuracy, offset, length, isConstructor, isSynthetic,
            isOverridden, insideDocComment, participant, resource);
}

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

License:Open Source License

public PackageReferenceMatch newPackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset,
        int length, ASTNode reference) {
    SearchParticipant participant = getParticipant();
    IResource resource = this.currentPossibleMatch.resource;
    boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0;
    return new PackageReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant,
            resource);/*from  w ww  .j  a  v a  2 s  .  c om*/
}

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

License:Open Source License

public SearchMatch newTypeParameterReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset,
        int length, ASTNode reference) {
    int bits = reference.bits;
    boolean insideDocComment = (bits & ASTNode.InsideJavadoc) != 0;
    SearchParticipant participant = getParticipant();
    IResource resource = this.currentPossibleMatch.resource;
    return new TypeParameterReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment,
            participant, resource);/*w  ww. jav  a 2s .c o  m*/
}

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

License:Open Source License

public TypeReferenceMatch newTypeReferenceMatch(IJavaElement enclosingElement, Binding enclosingBinding,
        int accuracy, int offset, int length, ASTNode reference) {
    SearchParticipant participant = getParticipant();
    IResource resource = this.currentPossibleMatch.resource;
    boolean insideDocComment = (reference.bits & ASTNode.InsideJavadoc) != 0;
    if (enclosingBinding != null)
        enclosingElement = ((JavaElement) enclosingElement).resolved(enclosingBinding);
    return new TypeReferenceMatch(enclosingElement, accuracy, offset, length, insideDocComment, participant,
            resource);//  www .  ja v  a 2s .co m
}

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

License:Open Source License

public int match(MessageSend node, MatchingNodeSet nodeSet) {
    if (!this.pattern.findReferences)
        return IMPOSSIBLE_MATCH;

    if (!matchesName(this.pattern.selector, node.selector))
        return IMPOSSIBLE_MATCH;
    if (this.pattern.parameterSimpleNames != null
            && (!this.pattern.varargs || ((node.bits & ASTNode.InsideJavadoc) != 0))) {
        int length = this.pattern.parameterSimpleNames.length;
        ASTNode[] args = node.arguments;
        int argsLength = args == null ? 0 : args.length;
        if (length != argsLength)
            return IMPOSSIBLE_MATCH;
    }/*www.  j  a  v a  2  s . c o  m*/

    return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
}

From source file:org.eclipse.che.jdt.internal.core.search.matching.ConstructorLocator.java

License:Open Source License

/**
 * Special case for message send in javadoc comment. They can be in fact bound to a constructor.
 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=83285"
 *//*  ww w. j  av  a2s  . c om*/
public int match(MessageSend msgSend, MatchingNodeSet nodeSet) {
    if ((msgSend.bits & ASTNode.InsideJavadoc) == 0)
        return IMPOSSIBLE_MATCH;
    if (!this.pattern.findReferences)
        return IMPOSSIBLE_MATCH;
    if (this.pattern.declaringSimpleName == null
            || CharOperation.equals(msgSend.selector, this.pattern.declaringSimpleName)) {
        return nodeSet.addMatch(msgSend, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
    }
    return IMPOSSIBLE_MATCH;
}