use of org.eclipse.xtext.findReferences.ReferenceAcceptor in project xtext-core by eclipse.
the class DocumentSymbolService method getReferences.
public List<? extends Location> getReferences(final XtextResource resource, final int offset, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) {
final EObject element = this._eObjectAtOffsetHelper.resolveElementAt(resource, offset);
if ((element == null)) {
return CollectionLiterals.<Location>emptyList();
}
final ArrayList<Location> locations = CollectionLiterals.<Location>newArrayList();
final TargetURIs targetURIs = this.collectTargetURIs(element);
final IAcceptor<IReferenceDescription> _function = (IReferenceDescription reference) -> {
final Procedure1<EObject> _function_1 = (EObject obj) -> {
final Location location = this._documentExtensions.newLocation(obj, reference.getEReference(), reference.getIndexInList());
if ((location != null)) {
locations.add(location);
}
};
this.doRead(resourceAccess, reference.getSourceEObjectUri(), _function_1);
};
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(this.resourceServiceProviderRegistry, _function);
CancelIndicatorProgressMonitor _cancelIndicatorProgressMonitor = new CancelIndicatorProgressMonitor(cancelIndicator);
this.referenceFinder.findAllReferences(targetURIs, resourceAccess, indexData, _referenceAcceptor, _cancelIndicatorProgressMonitor);
return locations;
}
use of org.eclipse.xtext.findReferences.ReferenceAcceptor in project xtext-core by eclipse.
the class DefaultCallHierarchyBuilder method findTargetDeclarations.
protected void findTargetDeclarations(final URI sourceDeclarationURI, final IProgressMonitor monitor, final Procedure2<? super IEObjectDescription, ? super IReferenceDescription> acceptor) {
final IUnitOfWork<Object, EObject> _function = (EObject sourceDeclaration) -> {
Object _xblockexpression = null;
{
IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry();
final IAcceptor<IReferenceDescription> _function_1 = (IReferenceDescription reference) -> {
boolean _filterReference = this.filterReference(reference);
if (_filterReference) {
IEObjectDescription _findTargetDeclaration = null;
if (reference != null) {
_findTargetDeclaration = this.findTargetDeclaration(reference);
}
final IEObjectDescription targetDeclaration = _findTargetDeclaration;
acceptor.apply(targetDeclaration, reference);
}
};
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function_1);
this.getReferenceFinder().findAllReferences(sourceDeclaration, _referenceAcceptor, monitor);
_xblockexpression = null;
}
return _xblockexpression;
};
this.<Object>readOnly(sourceDeclarationURI, _function);
}
use of org.eclipse.xtext.findReferences.ReferenceAcceptor in project xtext-core by eclipse.
the class DefaultCallHierarchyBuilder method findSourceDeclarations.
protected void findSourceDeclarations(final URI targetDeclarationURI, final IProgressMonitor monitor, final Procedure2<? super IEObjectDescription, ? super IReferenceDescription> acceptor) {
final TargetURIs targetURIs = this.collectTargetURIs(targetDeclarationURI);
IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry();
final IAcceptor<IReferenceDescription> _function = (IReferenceDescription reference) -> {
boolean _filterReference = this.filterReference(reference);
if (_filterReference) {
IEObjectDescription _findSourceDeclaration = null;
if (reference != null) {
_findSourceDeclaration = this.findSourceDeclaration(reference);
}
final IEObjectDescription sourceDeclaration = _findSourceDeclaration;
acceptor.apply(sourceDeclaration, reference);
}
};
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function);
this.getReferenceFinder().findAllReferences(targetURIs, this.getResourceAccess(), this.getIndexData(), _referenceAcceptor, monitor);
}
Aggregations