|
|
|
Re: ResourceSet containing single Resource or all Resources [message #650786 is a reply to message #650772] |
Wed, 26 January 2011 14:19 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Nicolas,
where does 'index' come from? Please note that the builder cannot use
the injected IResourceDescriptions but uses something that should be
grabbed from the resource set. See getResourceDescriptions(..) in the
AbstractGlobalScopeProvider.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 26.01.11 14:35, schrieb Nicolas Cabanis:
> The index seems not to contain the required objects either. The
> 'LocalScope' delegates to the 'GlobalScope'. In the 'GlobalScope' the
> 'findAllEObjects' methods does not find all objects. Now it's the
> complete opposite - the clean build does not work (or only partly) but
> the build seems to work if a resource is modified in the editor.
>
>
> private IScope getScopeFor_XXX (EObject context)
> {
> EClass type = XXX
> Resource resource = context.eResource ();
> IResourceDescription description = getDescription (resource);
>
> IContainer.Manager manager = getResourceServiceProvider
> (resource).getContainerManager ();
> IContainer container = manager.getContainer (description, index);
> IScope globalScope = new GlobalScope (container, type);
> return new LocalScope (nameProvider, description, type, context,
> globalScope);
> }
>
> private class GlobalScope implements IScope
> {
> private final IContainer container;
> private final EClass type;
>
> public GlobalScope (IContainer container, EClass type)
> {
> this.container = container;
> this.type = type;
> }
>
> @Override
> public IEObjectDescription getContentByName (String name)
> {
> Iterable<IEObjectDescription> found = container.findAllEObjects (type,
> name);
> Iterator<IEObjectDescription> it = found.iterator ();
> if (it.hasNext ()) return it.next ();
> return null;
> }
>
> ...
> }
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04619 seconds