예제 #1
0
 private void searchForTypesUsed(
     SearchEngine engine, IJavaElement parent, IType[] types, IJavaSearchScope scope)
     throws CoreException {
   for (int i = 0; i < types.length; i++) {
     if (types[i].isAnonymous()) continue;
     TypeReferenceSearchRequestor requestor = new TypeReferenceSearchRequestor();
     engine.search(
         SearchPattern.createPattern(types[i], IJavaSearchConstants.REFERENCES),
         new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
         scope,
         requestor,
         null);
     if (requestor.containMatches()) {
       TypeDeclarationSearchRequestor decRequestor = new TypeDeclarationSearchRequestor();
       engine.search(
           SearchPattern.createPattern(types[i], IJavaSearchConstants.DECLARATIONS),
           new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
           SearchEngine.createJavaSearchScope(new IJavaElement[] {parent}),
           decRequestor,
           null);
       Match match = decRequestor.getMatch();
       if (match != null) fSearchResult.addMatch(match);
     }
   }
 }
예제 #2
0
  private void findMatches(IPluginExtensionPoint point) {
    String fullID = point.getFullId();
    if (fullID == null) return;

    IPluginExtension[] extensions = fModel.getPluginBase().getExtensions();
    for (int i = 0; i < extensions.length; i++) {
      if (fullID.equals(extensions[i].getPoint())) {
        int line = ((ISourceObject) extensions[i]).getStartLine() - 1;
        if (line >= 0) {
          fSearchResult.addMatch(new Match(point, Match.UNIT_LINE, line, 1));
          break;
        }
      }
    }
  }