scopes
Hi I'm trying to the scopes right for my domains language. (Similar to entity example).
Domains can inherit from one another, but I want to prevent getting cyclic inheritance.
So I have set up a constraint on my Domain concept setting the constraint for the base-reference to inherited
link {base}
referent set handler:<none>
scope:
search for Domein
presentation :
<no presentation>
;
now I'm stuck on how to implement the ScopeProvider in Domain_Behavior.
It seems that I'm missing a way to obtain the default scope for Domains. i.e. the scope taht contains all Domains in the current and imported model. If I got that, I can use a FilteringScope to exlude the current domain and all Domains that inherit from it (recursively).
A clue anyone?
Domains can inherit from one another, but I want to prevent getting cyclic inheritance.
So I have set up a constraint on my Domain concept setting the constraint for the base-reference to inherited
link {base}
referent set handler:<none>
scope:
search for Domein
presentation :
<no presentation>
;
now I'm stuck on how to implement the ScopeProvider in Domain_Behavior.
It seems that I'm missing a way to obtain the default scope for Domains. i.e. the scope taht contains all Domains in the current and imported model. If I got that, I can use a FilteringScope to exlude the current domain and all Domains that inherit from it (recursively).
A clue anyone?
Please sign in to leave a comment.
all Domains in the current and imported models. How do I get access to
those?
On Sat, Jun 15, 2013 at 11:03 PM, Jens Nerche - Meta Programming System <
jetforum@jetbrains.com> wrote:
--
Gert Veldhuijzen van Zanten
06 - 40992488
It is indeed easier to use a search scope, rather than an inherited scope.
This is the code:
link {base}
referent set handler:<none>
scope:
(model, exists, contextNode, contextRole, position, scope, referenceNode, linkTarget, enclosingNode, containingLink, operationContext)->Scope {
ListScope.forNamedElements(model.rootsIncludingImported(scope , Domein).where({~it => !(isSubtype(it.type :< contextNode.type)); }));
}
presentation :
<no presentation>
;
What I was missing was the use of model.rootsInclusingImported and the fact that it takes an IScope argument rather than a Scope argument.