| Customizing initializers with more OCL [message #212728] |
Thu, 04 December 2008 05:27  |
Eclipse User |
|
|
|
Hi,
I am looking for a bit of advise on how to achieve my next challenge:
What I want to do is to have a more customized way to enforce
constraints when linking nodes in a diagram.
1. I have two models, one model holds the rules for allowing
relationships, this model is not edited by the diagram editor. The
second model has the nodes and relationships and manipulated with the
diagram editor.
From the GMF tutorial, I learned constraints can be set in i.e.
LinkMapping using the OCL language. Sniffing around a bit, I believe
this goes into a class called "ElementInializers" (in the package
*.providers).
Now back to my case, where I need to constrain based on the values in my
second model.
1. Should I use the "LinkMapping" constraint principle, and try to use
OCL to query a second model? (Is this even possible with OCL)
2. Shall I manually extend the "ElementInitializers" class to add
queries to my second model?
3. Am I totally of, and there is a more practical way to do these things?
Many thanks, Christophe Bouhier
|
|
|
| Re: Customizing initializers with more OCL [message #212760 is a reply to message #212728] |
Thu, 04 December 2008 06:21  |
Eclipse User |
|
|
|
Hello Christophe,
> 1. Should I use the "LinkMapping" constraint principle, and try to use
> OCL to query a second model? (Is this even possible with OCL)
If you are going to add creation constraints to the diagram link then this
is a proper way (add new instance of LinkConstraints under creationConstraints
containment feature in LinkMapping and use it to specify source/target end
constraints.).
It should be not a problem to use other modules in OCL – corresponding elements
should be referenced somehow from the original model and then you should
be able to use it like: “self.referencedSecondmodelElement.isLinkCreationAllowed
|
|
|
Powered by
FUDForum. Page generated in 0.02839 seconds