Java 类org.eclipse.xtext.resource.impl.DefaultReferenceDescription 实例源码

项目:n4js    文件:HeadlessReferenceFinder.java   
/**
 * 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;
}
项目:xtext-core    文件:ReferenceAcceptor.java   
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);
}