Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Containers inside containers(How do i put a cardinality restriction)
icon7.gif  Containers inside containers [message #1441165] Thu, 09 October 2014 10:50 Go to next message
Paulo Pimenta is currently offline Paulo PimentaFriend
Messages: 4
Registered: September 2014
Junior Member
Hello.. Smile

Fisrt of all, congratulations for the nice work with sirius. Keep the noce job..Smile.

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 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
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
Re: Containers inside containers [message #1441856 is a reply to message #1441490] Fri, 10 October 2014 09:24 Go to previous messageGo to next message
Paulo Pimenta is currently offline Paulo PimentaFriend
Messages: 4
Registered: September 2014
Junior Member
Maxime,

It works like a charm!! Thank you very much, i was struggling on that for two days.

Best regards,

Paulo Pimenta
Re: Containers inside containers [message #1583845 is a reply to message #1441856] Sun, 25 January 2015 11:41 Go to previous message
MG Gharib is currently offline MG GharibFriend
Messages: 30
Registered: September 2014
Member
Hi Paulo,
Is it possible to include the code or snapshots of the screen. I'm facing the same problem and I couldn't solve it so far.
Best regards
Previous Topic:Create a new secondary aird file programmatically and as an enduser using the user interface
Next Topic:Immediate execution Tool
Goto Forum:
  


Current Time: Tue Apr 23 10:02:01 GMT 2024

Powered by FUDForum. Page generated in 0.04537 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top