List of usage examples for org.eclipse.jdt.core.search LocalVariableReferenceMatch LocalVariableReferenceMatch
public LocalVariableReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean isReadAccess, boolean isWriteAccess, boolean insideDocComment, SearchParticipant participant, IResource resource)
From source file:org.eclipse.jdt.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; }// w w w. j a v a 2s . c om } } 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); }