Home » Eclipse Projects » Sirius » Containers inside containers(How do i put a cardinality restriction)
Containers inside containers [message #1441165] |
Thu, 09 October 2014 10:50 |
Paulo Pimenta Messages: 4 Registered: September 2014 |
Junior Member |
|
|
Hello..
Fisrt of all, congratulations for the nice work with sirius. Keep the noce job...
My question is, i believe simple, but i don't know how come it doesn't work. I have a diagram that works nice, etc. One of the elements of my model is represented by an Container (Class), which in turn, can have several Protocols container (protocols containment relation) elements inside. The protocol class, in turn, has tree subclasses : Control, Init and Custom.
I tried to create a container tool, on which I would like to put a restriction, to say that my container Class can only receive one container Control, one container Init and several container custom. For the custom, it is ok. For the control and iinit containers, i've tried :
[self.eContainer().eContents().toString()->count('Control') = 0/]
and several other options, but none seems to restrict the creation of more than one instance. The class containment protocols relation is (0..*) Also, I've created a creation container tool, but i dont know if maybe, that is the part of problem. The images attached show how i did.
Thanks in advance for all answers,
Regards,
Paulo
|
|
|
Re: Containers inside containers [message #1441490 is a reply to message #1441165] |
Thu, 09 October 2014 20:18 |
|
Le 09/10/2014 12:50, Paulo Pimenta a écrit :
> Hello.. :)
Hello
>
> Fisrt of all, congratulations for the nice work with sirius. Keep the noce job..:).
Thanks !
>
> My question is, i believe simple, but i don't know how come it doesn't work. I have a diagram that works nice, etc. One of the elements of my model is represented by an Container (Class), which in turn, can have several Protocols container (protocols containment relation) elements inside. The protocol class, in turn, has tree subclasses : Control, Init and Custom.
>
> I tried to create a container tool, on which I would like to put a restriction, to say that my container Class can only receive one container Control, one container Init and several container custom. For the custom, it is ok. For the control and iinit containers, i've tried :
>
> [self.eContainer().eContents().toString()->count('Control') = 0/]
It seems that you should complete the precondition expression of your
container creation tool with something like:
[container.eContents()->filter(Control)->size()=0/]
You can also replace eContents() per the Control containment feature
name in your metamodel.
Then in you tool, you should replace your if model operation by a
ChangeContext one with the var:container expression, to get as context
the semantic/domain element corresponding to clicked graphical element
(containerView). It will be your Class.
Then you should put the name of your containment feature able to contain
the Control in the feature name field of the CreateInstance operation.
>
> and several other options, but none seems to restrict the creation of more than one instance. The class containment protocols relation is (0..*) Also, I've created a creation container tool, but i dont know if maybe, that is the part of problem. The images attached show how i did.
>
> Thanks in advance for all answers,
>
> Regards,
>
> Paulo
>
>
Regards
--
Maxime - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| | |
Goto Forum:
Current Time: Tue Apr 23 10:02:01 GMT 2024
Powered by FUDForum. Page generated in 0.04537 seconds
|