List of usage examples for org.eclipse.jdt.core.search MethodReferenceMatch MethodReferenceMatch
public MethodReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, boolean constructor, boolean synthetic, boolean superInvocation, boolean insideDocComment, SearchParticipant participant, IResource resource)
From source file:org.eclipse.ajdt.internal.core.search.ITDReferenceVisitor.java
License:Open Source License
@SuppressWarnings("unchecked") private void checkMethodPattern(MethodRef node) { if (methodPattern != null) { if (node.getName().equals(String.valueOf(methodPattern.selector))) { int i = 0; // don't do matching on qualified names if (node.parameters().size() == methodPattern.parameterCount) { for (MethodRefParameter param : (Iterable<MethodRefParameter>) node.parameters()) { if (!(param.getName().equals(String.valueOf(methodPattern.parameterSimpleNames[i])))) { return; }//from w w w.j av a2 s . com } } definitiveMatches.add(new MethodReferenceMatch(itd, SearchMatch.A_ACCURATE, node.getName().getStartPosition(), node.getName().getLength(), false, false, false, true, participant, itd.getResource())); } } }
From source file:org.eclipse.ajdt.internal.core.search.ITDReferenceVisitor.java
License:Open Source License
private void checkMethodPattern(MethodInvocation node) { if (methodPattern != null) { if (node.getName().getIdentifier().equals(String.valueOf(methodPattern.selector))) { if (node.getExpression() == null || node.getExpression().getNodeType() == ASTNode.THIS_EXPRESSION) { // only match on number of parameters if (node.arguments().size() == methodPattern.parameterCount) { // avoid double reporting. These are already // reported by standard searching // so, add to tentative matches instead. tentativeMatches.add(new MethodReferenceMatch(itd, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), false, false, false, true, participant, itd.getResource())); }//w w w .ja va 2 s .c om } } } }
From source file:org.eclipse.jdt.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); }