/** * Find all references to the given target with its resource set as working environment. * * @param target * the object to look for. * @param monitor * the progress monitor. * @return the list of reference descriptions. */ public List<IReferenceDescription> findReferencesTo(EObject target, IProgressMonitor monitor) { final TargetURIs targetURIs = getTargetURIs(target); final ResourceSet resourceSet = target.eResource().getResourceSet(); final List<IReferenceDescription> result = Lists.newArrayList(); IReferenceFinder.IResourceAccess resourceAccess = new SimpleResourceAccess(resourceSet); IReferenceFinder.Acceptor acceptor = new IReferenceFinder.Acceptor() { @Override public void accept(IReferenceDescription description) { result.add(description); } @Override public void accept(EObject source, URI sourceURI, EReference eReference, int index, EObject targetOrProxy, URI targetURI) { accept(new DefaultReferenceDescription(sourceURI, targetURI, eReference, index, null)); } }; referenceFinder.findAllReferences(targetURIs, resourceAccess, resourceDescriptionsProvider.getResourceDescriptions(resourceSet), acceptor, monitor); return result; }
protected IReferenceDescription createReferenceDescription(final URI sourceURI, final URI targetURI, final EReference eReference, final int index, final URI containerURI) { return new DefaultReferenceDescription(sourceURI, targetURI, eReference, index, containerURI); }