예제 #1
0
 public void findIndexedReferences(
     final IQueryData queryData,
     final IAcceptor<IReferenceDescription> acceptor,
     IProgressMonitor monitor) {
   findIndexedReferences(
       queryData.getTargetURIs(), acceptor, queryData.getResultFilter(), monitor);
 }
예제 #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);
       }
     }
   }
 }
예제 #3
0
 public void findAllReferences(
     IQueryData queryData,
     ILocalResourceAccess localResourceAccess,
     final IAcceptor<IReferenceDescription> acceptor,
     IProgressMonitor monitor) {
   final SubMonitor subMonitor = SubMonitor.convert(monitor, 2);
   if (!queryData.getTargetURIs().isEmpty()) {
     findLocalReferences(queryData, localResourceAccess, acceptor, subMonitor.newChild(1));
     findIndexedReferences(queryData, acceptor, subMonitor.newChild(1));
   }
 }
예제 #4
0
 public void findLocalReferences(
     final IQueryData queryData,
     ILocalResourceAccess localResourceAccess,
     final IAcceptor<IReferenceDescription> acceptor,
     IProgressMonitor monitor) {
   final SubMonitor subMonitor = SubMonitor.convert(monitor, "Find references", 1);
   localResourceAccess.readOnly(
       queryData.getLocalContextResourceURI(),
       new IUnitOfWork<Boolean, ResourceSet>() {
         public Boolean exec(ResourceSet localContext) throws Exception {
           Set<EObject> targets = newHashSet();
           for (URI targetURI : queryData.getTargetURIs()) {
             EObject target = localContext.getEObject(targetURI, true);
             if (target != null) targets.add(target);
           }
           findLocalReferences(targets, acceptor, queryData.getResultFilter(), subMonitor);
           return true;
         }
       });
 }