Search in sources :

Example 1 with FilterUriContainer

use of org.eclipse.xtext.resource.containers.FilterUriContainer in project n4js by eclipse.

the class N4JSGlobalScopeProvider method createContainerScopeWithContext.

/**
 * Creates a new container scope containing only resource descriptions of the current project. With this container a
 * {@link UserDataAwareScope} is created.
 * <p>
 * This method is called for every container (that is source folder or archive) the current project depends on
 * according to the settings in the manifest,. This information has been indirectly retrieved via
 * {@link org.eclipse.n4js.projectModel.IN4JSProject#getDependencies()}.
 */
@Override
protected IScope createContainerScopeWithContext(Resource resource, IScope parent, IContainer container, Predicate<IEObjectDescription> filter, EClass type, boolean ignoreCase) {
    if (resource != null) {
        URI uriToFilter = resource.getURI();
        // do filter context-resource from scope except in case of static polyfills.
        if (container.hasResourceDescription(uriToFilter) && !isStaticPolyFiller(resource))
            container = new FilterUriContainer(uriToFilter, container);
        IScope result = UserDataAwareScope.createScope(parent, container, filter, type, ignoreCase, resource.getResourceSet(), canLoadFromDescriptionHelper, container);
        return result;
    }
    return IScope.NULLSCOPE;
}
Also used : FilterUriContainer(org.eclipse.xtext.resource.containers.FilterUriContainer) IScope(org.eclipse.xtext.scoping.IScope) URI(org.eclipse.emf.common.util.URI)

Aggregations

URI (org.eclipse.emf.common.util.URI)1 FilterUriContainer (org.eclipse.xtext.resource.containers.FilterUriContainer)1 IScope (org.eclipse.xtext.scoping.IScope)1