List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode IsStrictlyAssigned
int IsStrictlyAssigned
To view the source code for org.eclipse.jdt.internal.compiler.ast ASTNode IsStrictlyAssigned.
Click Source Link
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; }/* w ww . j ava 2 s . com*/ } } 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; }//www. j a v a 2 s. 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); }