Search in sources :

Example 1 with ResourceSetReferencingResourceSet

use of org.eclipse.xtext.resource.ResourceSetReferencingResourceSet in project xtext-core by eclipse.

the class ResourceSetGlobalScopeProvider method getScope.

@Override
protected IScope getScope(Resource resource, boolean ignoreCase, EClass type, Predicate<IEObjectDescription> filter) {
    IScope parent = IScope.NULLSCOPE;
    if (resource == null || resource.getResourceSet() == null)
        return parent;
    final ResourceSet resourceSet = resource.getResourceSet();
    if (resourceSet instanceof ResourceSetReferencingResourceSet) {
        ResourceSetReferencingResourceSet set = (ResourceSetReferencingResourceSet) resourceSet;
        Iterable<ResourceSet> referencedSets = Lists.reverse(set.getReferencedResourceSets());
        for (ResourceSet referencedSet : referencedSets) {
            parent = createScopeWithQualifiedNames(parent, resource, filter, referencedSet, type, ignoreCase);
        }
    }
    return createScopeWithQualifiedNames(parent, resource, filter, resourceSet, type, ignoreCase);
}
Also used : ResourceSetReferencingResourceSet(org.eclipse.xtext.resource.ResourceSetReferencingResourceSet) IScope(org.eclipse.xtext.scoping.IScope) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) ResourceSetReferencingResourceSet(org.eclipse.xtext.resource.ResourceSetReferencingResourceSet)

Aggregations

ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 ResourceSetReferencingResourceSet (org.eclipse.xtext.resource.ResourceSetReferencingResourceSet)1 IScope (org.eclipse.xtext.scoping.IScope)1