use of org.eclipse.jdt.core.search.LocalVariableDeclarationMatch in project che by eclipse.
the class NewSearchResultCollector method acceptSearchMatch.
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
IJavaElement enclosingElement = (IJavaElement) match.getElement();
if (enclosingElement != null) {
if (fIgnorePotentials && (match.getAccuracy() == SearchMatch.A_INACCURATE))
return;
boolean isWriteAccess = false;
boolean isReadAccess = false;
if (match instanceof FieldReferenceMatch) {
FieldReferenceMatch fieldRef = ((FieldReferenceMatch) match);
isWriteAccess = fieldRef.isWriteAccess();
isReadAccess = fieldRef.isReadAccess();
} else if (match instanceof FieldDeclarationMatch) {
isWriteAccess = true;
} else if (match instanceof LocalVariableReferenceMatch) {
LocalVariableReferenceMatch localVarRef = ((LocalVariableReferenceMatch) match);
isWriteAccess = localVarRef.isWriteAccess();
isReadAccess = localVarRef.isReadAccess();
} else if (match instanceof LocalVariableDeclarationMatch) {
isWriteAccess = true;
}
boolean isSuperInvocation = false;
if (match instanceof MethodReferenceMatch) {
MethodReferenceMatch methodRef = (MethodReferenceMatch) match;
isSuperInvocation = methodRef.isSuperInvocation();
}
fSearch.addMatch(new JavaElementMatch(enclosingElement, match.getRule(), match.getOffset(), match.getLength(), match.getAccuracy(), isReadAccess, isWriteAccess, match.isInsideDocComment(), isSuperInvocation));
}
}
Aggregations