Set reference to existing class instance with tool [message #1843206] |
Tue, 20 July 2021 08:17 |
Aron S Messages: 4 Registered: June 2021 |
Junior Member |
|
|
Hey,
simplified i have the meta model below:
I already have a tool to create instances of Class_B.
Now I want to create a second tool which creates an instance of Class_A, an instance of Child_A, let the user choose a corresponding class_b from allB and sets the reference.
How can i achieve this?
I tried two approaches using the Open Dialog:
1. The Reference widget (https://www.eclipse.org/sirius/doc/specifier/properties/Properties_View_Description.html#reference) seems to do exactly what i want, but i couldn't get it to work. It does not appear in the dialog at all.
2. I used the Radio widget. With aql:container.allB as Candidate Expression the dialog shows all available instances of Class_B, but it doesn't create the Child_A instance (and the reference of course neither).
The corresponding .odesign configuration:
And i attached the example project.
Best regards,
Aron
-
Attachment: project.zip
(Size: 169.57KB, Downloaded 66 times) -
Attachment: metaModel.png
(Size: 15.44KB, Downloaded 283 times) -
Attachment: odesign.png
(Size: 17.40KB, Downloaded 297 times)
|
|
|
Re: Set reference to existing class instance with tool [message #1843582 is a reply to message #1843206] |
Mon, 09 August 2021 13:02 |
|
Hello,
Concerning your questions about the Open dialog approach:
1. You need to change the semantic candidate expression in Default Page/Group in order to display the list of Class_B element that should be displayed in the dialog. On the sample it is set on var:self that is the newly created Class_A element.
2. You need to move the model operations you placed under Default Group to be placed under the "OK" button element so the variable with the selection will be valued at this point.
Note that you can have the same result without needing a dialog, by using the "classB" mapping as an extra mapping (tab "Advanced") of the node creation tool. This will allow you to click on a Class_B element when you want to create a Class_A element. In your tool, you will need to start with a if to check if the variable container is an instance of Class_B, but from there you can create ClassA, ChildA and link it to Class_B.
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.02358 seconds