private void searchForDeclarations( SearchEngine engine, DartElement element, SearchScope scope, SearchFilter filter, SearchResultCollector listener, IProgressMonitor monitor) throws CoreException, SearchException { switch (element.getElementType()) { case DartElement.CLASS_TYPE_ALIAS: case DartElement.FUNCTION_TYPE_ALIAS: case DartElement.FUNCTION: case DartElement.IMPORT: case DartElement.TYPE: case DartElement.TYPE_PARAMETER: case DartElement.VARIABLE: { SourceRange range = ((SourceReference) element).getSourceRange(); SearchMatch match = new SearchMatch(MatchQuality.EXACT, element, range); if (filter == null || filter.passes(match)) { listener.matchFound(match); } break; } case DartElement.FIELD: case DartElement.METHOD: { // There's no way to tell which hierarchy an untyped reference might refer to, so find all // declarations. DartIdentifier identifier = new DartIdentifier(element.getElementName()); searchForDeclarations(engine, identifier, scope, filter, listener, monitor); break; } default: throw new UnsupportedOperationException( "unsupported search type: " + element.getClass()); // $NON-NLS-1$ } }
private void searchForOverrides( SearchEngine engine, DartElement element, SearchScope scope, SearchFilter filter, SearchResultCollector listener, IProgressMonitor monitor) throws CoreException { switch (element.getElementType()) { case DartElement.CLASS_TYPE_ALIAS: case DartElement.FUNCTION_TYPE_ALIAS: case DartElement.FUNCTION: case DartElement.FIELD: case DartElement.IMPORT: case DartElement.TYPE: case DartElement.TYPE_PARAMETER: case DartElement.VARIABLE: { break; } case DartElement.METHOD: { MemberDeclarationsReferences memberInfo; memberInfo = RenameAnalyzeUtil.findDeclarationsReferences((Method) element, monitor); for (TypeMember member : memberInfo.declarations) { SearchMatch match = new SearchMatch(MatchQuality.EXACT, member, member.getSourceRange()); listener.matchFound(match); } break; } default: throw new UnsupportedOperationException( "unsupported search type: " + element.getClass()); // $NON-NLS-1$ } }