Persistence issues of visual constraints when using dynamic ecore extensions [message #1752881] |
Mon, 30 January 2017 09:23 |
Joerg Hermann Messages: 15 Registered: September 2012 Location: Munich |
Junior Member |
|
|
Hi *,
to support some user specific customizations in the model, I have introduced dynamic extensions of the static Ecore metamodel, following the description from https://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/.
Basically, there is a common superclass defined in the static model, which is then subclassed by dynamic classes. The type of the superclass is referenced from the Sirius description to be represented by a border node.
The dynamic model extensions are created within the resourceImpl of the static model to have them available whenever a model is loaded.
This works fine so far, the dynamic instances are serialized correctly and read back as well and the property view shows all the attributes that have been defined in the dynamic classes.
The only thing that is not working is persisting of the positions of the border nodes associated with these dynamic instances. Even more, the diagram is marked as 'dirty' immediately after opening, which is even a bit more annoying.
Looking at the *.aird, I saw, that these instances always get new xmi:id values. It seems that Sirius treats them as completely new instances within the loaded model. (see attached screenshot with a comparison of the serialized version after modifying the positions (left) and after closing/reopening, which reverts to the defaults (right)).
Is there any way to convince Sirius that I'm still referring to the same objects (btw. there is no difference in the serialized model between these two cases)?
Any ideas or suggestions are highly appreciated
Kind regards,
Joerg
|
|
|
|
Re: Persistence issues of visual constraints when using dynamic ecore extensions [message #1752980 is a reply to message #1752911] |
Tue, 31 January 2017 15:10 |
Joerg Hermann Messages: 15 Registered: September 2012 Location: Munich |
Junior Member |
|
|
Hi Florian,
first of all, thanks a lot for your hint.
I made some more investigations; I try to summarize below:
* The instances of the dynamic extended eClasses are serialized correctly into the 'main' model. These instances get the namespace prefix as specified within the dynamic ePackage, like <myReference xsi:type="dynextensionpkg:ExtendedClassName" ...
* The model is serialized as XMI, but I do not use UUID's; I have double checked in the resource getId() function; it alway returns null.
* I tried to modify the getId() to return a stable Id for the instances of the dynamic extension; -> no change
* Finally, I tried to serialize the package of the dynamic extension, which was in memory only before into a resource within the workspace. On next start, I loaded the metamodel from this resource instead of creating it dynamically again. Now, the positions of my border nodes remained stable.
The last trial at least shows a partial solution, but it contradicts the dynamic extension behavior that I have implemented.
Do you know, what is the criteria for the objects to be regarded as 'new'?
Is it possibly the fact, that the non-serialized metamodel comes without a resource?
Can you think of a way to tweak this to 'simulate' the resource-based behavior?
Any ideas are helpful... I will continue my trials in the meantime; maybe I can track down the differences between the two cases...
-
kind regards,
Joerg
|
|
|
|
Powered by
FUDForum. Page generated in 0.03199 seconds