use of com.avaloq.tools.ddk.xtext.scoping.impl.BranchingScope in project dsl-devkit by dsldevkit.
the class AbstractPolymorphicScopeProvider method newDataMatchScope.
/**
* Create a new container scope using the results of a given query as its contents.
*
* @param id
* Human-readable name of the scope, typically used to identify where the scope was created. Useful for debugging.
* @param outer
* The outer scope of the new scope.
* @param context
* The context
* @param query
* The query that defines the scope's contents
* @param originalResource
* The original resource
* @param filters
* to apply
* @param nameFunctions
* The name functions to apply
* @param caseInsensitive
* indicates whether the new scope shall be case insensitive
* @return The new scope
*/
protected IScope newDataMatchScope(final String id, final IScope outer, final EObject context, final ContainerQuery query, final Resource originalResource, final Iterable<Predicate<IEObjectDescription>> filters, final Iterable<INameFunction> nameFunctions, final boolean caseInsensitive) {
IScope result = outer;
final List<String> domains = query.getDomains();
for (final IContainer container : Lists.reverse(getVisibleContainers(context, originalResource))) {
if (!domains.isEmpty()) {
final IDomain domain = domainMapper.map(container);
if (domain != null && !domains.contains(domain.getName())) {
// Query not applicable to this container.
continue;
}
}
// Build a branch in the scope chain so that we can filter each container query separately.
IScope contents = new ContainerBasedScope(id, IScope.NULLSCOPE, container, query, nameFunctions, caseInsensitive);
contents = new DataFilteringScope(contents, filters);
result = new BranchingScope(contents, result);
}
return result;
}
Aggregations