List of usage examples for org.eclipse.jdt.internal.compiler.ast LambdaExpression arrowPosition
int arrowPosition
To view the source code for org.eclipse.jdt.internal.compiler.ast LambdaExpression arrowPosition.
Click Source Link
From source file:org.eclipse.che.jdt.internal.core.search.matching.MatchLocator.java
License:Open Source License
protected void reportMatching(LambdaExpression lambdaExpression, IJavaElement parent, int accuracy, MatchingNodeSet nodeSet, boolean typeInHierarchy) throws CoreException { IJavaElement enclosingElement = null; // Report the lambda declaration itself. if (accuracy > -1) { enclosingElement = createHandle(lambdaExpression, parent); if (enclosingElement != null) { // skip if unable to find method // compute source positions of the selector int nameSourceStart = lambdaExpression.sourceStart; if (encloses(enclosingElement)) { SearchMatch match = null; int length = lambdaExpression.arrowPosition() + 1 - nameSourceStart; match = this.patternLocator.newDeclarationMatch(lambdaExpression, enclosingElement, null, accuracy, length, this); if (match != null) { report(match);/*from ww w . j av a 2 s.c o m*/ } } } } if (enclosingElement == null) { enclosingElement = createHandle(lambdaExpression, parent); } // Traverse the lambda declaration to report matches inside, these matches if any should see the present lambda as the parent // model element. ASTNode[] nodes = typeInHierarchy ? nodeSet.matchingNodes(lambdaExpression.sourceStart, lambdaExpression.sourceEnd) : null; boolean report = (this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0 && encloses(enclosingElement); MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, report ? nodes : null, nodeSet, this, typeInHierarchy); if (lambdaExpression.arguments != null) { int argumentsLength = lambdaExpression.arguments.length; for (int i = 0; i < argumentsLength; i++) lambdaExpression.arguments[i].traverse(declarationVisitor, (BlockScope) null); } if (lambdaExpression.body != null) { lambdaExpression.body.traverse(declarationVisitor, (BlockScope) null); } // Report all nodes and remove them if (nodes != null) { int length = nodes.length; for (int i = 0; i < length; i++) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(nodes[i]); if (report && level != null) { this.patternLocator.matchReportReference(nodes[i], enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), lambdaExpression.binding, level.intValue(), this); } } } }