Esempio n. 1
0
 private void searchForReferences(
     SearchEngine engine,
     DartElement element,
     SearchScope scope,
     SearchFilter filter,
     SearchListener collector,
     IProgressMonitor monitor)
     throws SearchException {
   switch (element.getElementType()) {
     case DartElement.METHOD:
       engine.searchReferences((Method) element, scope, filter, collector, monitor);
       break;
     case DartElement.CLASS_TYPE_ALIAS:
       engine.searchReferences((DartClassTypeAlias) element, scope, filter, collector, monitor);
       break;
     case DartElement.FUNCTION_TYPE_ALIAS:
       engine.searchReferences((DartFunctionTypeAlias) element, scope, filter, collector, monitor);
       break;
     case DartElement.FIELD:
       engine.searchReferences((Field) element, scope, filter, collector, monitor);
       break;
     case DartElement.FUNCTION:
       engine.searchReferences((DartFunction) element, scope, filter, collector, monitor);
       break;
     case DartElement.TYPE:
       engine.searchReferences((Type) element, scope, filter, collector, monitor);
       break;
     case DartElement.IMPORT:
       engine.searchReferences((DartImport) element, scope, filter, collector, monitor);
       break;
     case DartElement.VARIABLE:
       engine.searchReferences(
           (DartVariableDeclaration) element, scope, filter, collector, monitor);
       break;
     default:
       throw new UnsupportedOperationException(
           "unsupported search type: " + element.getClass()); // $NON-NLS-1$
   }
 }
Esempio n. 2
0
 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$
   }
 }
Esempio n. 3
0
 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$
   }
 }