Java 类org.eclipse.xtext.scoping.impl.SelectableBasedScope 实例源码

项目:statecharts    文件:AbstractLibraryGlobalScopeProvider.java   
@Override
public IScope getScope(Resource context, EReference reference, Predicate<IEObjectDescription> filter) {
    List<IEObjectDescription> descriptions = Lists.newArrayList();
    for (URI uri : getValidLibraries(context)) {
        try {
            Iterables.addAll(descriptions, libraryCache.get(uri, new Callable<Iterable<IEObjectDescription>>() {

                @Override
                public Iterable<IEObjectDescription> call() throws Exception {
                    return getDescriptions(context, uri);
                }
            }));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return SelectableBasedScope.createScope(IScope.NULLSCOPE, new EObjectDescriptionLookUp(descriptions),
            reference.getEReferenceType(), isIgnoreCase(reference));
}
项目:statecharts    文件:STextGlobalScopeProvider.java   
@Override
protected IScope createLazyResourceScope(IScope parent, URI uri, IResourceDescriptions descriptions, EClass type,
        Predicate<IEObjectDescription> filter, boolean ignoreCase) {
    IResourceDescription description = resourceDescriptionCache.get(uri);
    if (description == null)
        return IScope.NULLSCOPE;
    return SelectableBasedScope.createScope(parent, description, filter, type, ignoreCase);
}
项目:gama    文件:BuiltinGlobalScopeProvider.java   
@Override
protected IScope getScope(final Resource resource, final boolean ignoreCase, final EClass type,
        final Predicate<IEObjectDescription> filter) {
    IScope scope = getGlobalScope(type);
    final Collection<URI> uniqueImportURIs = getAllImportedURIs(resource, resource.getResourceSet()).keySet();
    if (uniqueImportURIs.size() == 1)
        return scope;
    final List<URI> urisAsList = Lists.newArrayList(uniqueImportURIs);
    urisAsList.remove(resource.getURI());
    Collections.reverse(urisAsList);
    final IResourceDescriptions descriptions = getResourceDescriptions(resource, urisAsList);

    scope = SelectableBasedScope.createScope(scope, descriptions, filter, type, false);
    return scope;
}
项目:xtext-extras    文件:XbaseImportedNamespaceScopeProvider.java   
@Override
protected IScope getGlobalScope(final Resource context, final EReference reference) {
    IScope globalScope = super.getGlobalScope(context, reference, null);
    return SelectableBasedScope.createScope(globalScope, getAllDescriptions(context), reference.getEReferenceType(), isIgnoreCase(reference));
}
项目:xtext-extras    文件:XImportSectionNamespaceScopeProvider.java   
@Override
protected IScope getGlobalScope(final Resource context, final EReference reference) {
    IScope globalScope = super.getGlobalScope(context, reference, null);
    return SelectableBasedScope.createScope(globalScope, getAllDescriptions(context), reference.getEReferenceType(), isIgnoreCase(reference));
}
项目:xtext-core    文件:XtextScopeProvider.java   
protected IScope doCreateScope(final Grammar grammar, final EClass type, IScope parent) {
    final IResourceDescription resourceDescription = resourceDescriptionManager.getResourceDescription(grammar.eResource());
    return SelectableBasedScope.createScope(parent, resourceDescription, type, false);
}