I am using Xtext 2.3.1
Within my ScopeProvider
I want to use the currently parsed rootModel
.
How to do so? Can I inject the RootModel or can I use the context?
public class MyLanguageScopeProvider extends AbstractDeclarativeScopeProvider {
public IScope scope_MyLangElement_ref(EObject context, EReference reference) {
HashMap<QualifiedName, EObject> elements = new HashMap<QualifiedName, EObject>();
// access model here, sth like:
RootModel rootModel = // ....
return new MapBasedScope(elements);
}
}
EcoreUtil.getRootContainer(context)
should do the trick.