Пример #1
0
 protected void findIndexedReferences(
     Set<URI> targetURIs,
     IAcceptor<IReferenceDescription> acceptor,
     Predicate<IReferenceDescription> filter,
     IProgressMonitor monitor) {
   Set<URI> targetResourceURIs =
       newHashSet(
           transform(
               targetURIs,
               new Function<URI, URI>() {
                 public URI apply(URI from) {
                   return from.trimFragment();
                 }
               }));
   int numResources = Iterables.size(index.getAllResourceDescriptions());
   SubMonitor subMonitor =
       SubMonitor.convert(monitor, Messages.ReferenceQuery_monitor, numResources);
   for (IResourceDescription resourceDescription : index.getAllResourceDescriptions()) {
     if (subMonitor.isCanceled()) return;
     if (!targetResourceURIs.contains(resourceDescription.getURI())) {
       for (IReferenceDescription referenceDescription :
           resourceDescription.getReferenceDescriptions()) {
         if (targetURIs.contains(referenceDescription.getTargetEObjectUri())
             && (filter == null || filter.apply(referenceDescription))) {
           acceptor.accept(referenceDescription);
         }
       }
     }
     subMonitor.worked(1);
   }
 }
Пример #2
0
 /** @since 2.0 */
 public void findIndexedReferences(
     IQueryData queryData,
     URI resourceURI,
     IAcceptor<IReferenceDescription> acceptor,
     IProgressMonitor progressMonitor) {
   IResourceDescription resourceDescription =
       index.getResourceDescription(resourceURI.trimFragment());
   if (resourceDescription != null) {
     for (IReferenceDescription referenceDescription :
         resourceDescription.getReferenceDescriptions()) {
       if (queryData.getTargetURIs().contains(referenceDescription.getTargetEObjectUri())
           && (queryData.getResultFilter() == null
               || queryData.getResultFilter().apply(referenceDescription))) {
         acceptor.accept(referenceDescription);
       }
     }
   }
 }