@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)); }
@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); }
@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; }
@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)); }
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); }