Community
Participate
Working Groups
Created attachment 99098 [details] Test metamodel, genmodel generated code and test models. Detected on EMF 2.4.0 M7 and Eclipse 3.4 M7. Also reproduced on Eclipse 3.3 and older EMF version. I've noticed a problem with synchronization on models that reference elements of other models. I've been using the latest stuff (Eclipse 3.4 M7 and EMF 2.4.0 M7). I detected this behaviour also in previous versions. I did investigate a bit, and end up in a repeatable sequence of steps. 1. Create an .ecore metamodel, with two Classes: ClassA (attribute name:EString, reference[0..1] refA:ClassA, reference[0..1] refB:ClassB) - refA is contained. ClassB (attribute name:EString, reference[0..1] refA:ClassA, reference[0..1] refB:ClassB) - refB is contained. 2. Create .genmodel and generate model, edit and editor. Ensure that contained references in the genmodel has "children", "create child" and "notify" to true. I also set "property type" to "none". 3. Execute a second eclipse instance, an generate two diferent models. The first will have ClassA as root, for the second, use ClassB as root. Save both and keep editors opened.. 4. Let's modify firstly the second model. Add a "ClassB" child to root. Set names for those classes to identify better, if you wish. Now SAVE. 5. Now modify the first model. Add a "ClassA" child to root. Let set the value for "refB" reference of this nested "ClassA" child. Use "Load Resource" to load the second file, so you can load deepest "ClassB" children. Now SAVE. 6. Ok, now add another ClassB in the second model (you should have now one root and 2 nested children). Now SAVE. Problem should arise. Go to first model editor, you should realized than the linked resource hasn't been synchronized. Furthermore, if you now modify it and save, changes in the second model would be overriden.
Created attachment 99280 [details] Changes to editor template Because we support "save only if changed", a resource being added to the saved resources list might not actually have been changed at all. It it's not really changed, we get no delta for it, so it's not cleared from that list. If later there is a real delta on it, it's ignored because the code is assuming it's an expected delta from an earlier save. I've changed it to use timestamps to check if a change should really be expected.
Dave, Please have a look at the patch.
The fix looks good.
The changes are committed to CVS.
Fix available in HEAD: 2.4.0.I200805121800.