Set reference to existing class instance with tool [message #1843206] |
Tue, 20 July 2021 04:17  |
Eclipse User |
|
|
|
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 115 times)
Attachment: metaModel.png
(Size: 15.44KB, Downloaded 358 times)
Attachment: odesign.png
(Size: 17.40KB, Downloaded 375 times)
|
|
|
|
Re: Set reference to existing class instance with tool [message #1843845 is a reply to message #1843582] |
Fri, 20 August 2021 07:22  |
Eclipse User |
|
|
|
Hey,
thanks for the reply!
Regarding the second approach: But how can i access the instance which corresponds to the selected radio button?
According to the documentary (https://www.eclipse.org/sirius/doc/specifier/properties/Properties_View_Description.html#radio_group) I can use the variable "newValue" underneath the "Begin" element of the radio.
To me it seems like the variable is not accessible under the "OK" button.
Regarding the extra mapping approach you suggested: In my actual editor Class_A will be crated in a container, so the extra mapping have to be used to select the target container.
Best Regards,
Aron
|
|
|
Powered by
FUDForum. Page generated in 0.04376 seconds