I have a node that has a single reference and several children that represent operations on the target of the reference. The operations need to be constrained by the type of the target. In other words, the user will choose a reference, and this will determine what operations the user sees as options on it (kind of like overloading functions).
Where in MPS is the best place to implement this functionality? The option I am using now is ok-ish: I am adding a constraint to the relevant statements such as "parentNode : MyParentConcept.reference.concept.isExactly(TheConstrainingNodeType)", but I was wondering if there are more elegant options (or better ways to check). If I could automatically add a child based on the type of reference the user selects, that would be nice. For example, if the user selects "Fruit" as the reference, I could automatically add a "FruitStatements" child that could then allow for the appropriate statement children.
Also, I was wondering if there is a good way to mark that a node can be the target of certain statements. For example, if another statement results in something that can be the target of "FruitStatements", what would be an elegant way to mark this? A somewhat constrained option would be to mark that type of statement with an interface and then look for its presence.