-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incremental Update breaks Source Model Tracking #6
Comments
Digging though the code I noticed that this reverted commit is the main thing that differs and causes the SourceModelTrackingAdapter to be removed whenever the incremental update copies the properties and alters the model element. |
What exactly is the problem? Please outline the erroneous scenario. I think it is wrong to not care about the former target of some single-value reference of an EObject while adding the new one to the maps. IMO this way you will end up with a memory leak. However, one might need to distinguish containment and non-containment cross references at this point, which hasn't been done yet. That might be a mistake but I'm not sure. Have a look at https://github.com/kieler/KLighD/blob/master/test/de.cau.cs.kieler.klighd.test/src/de/cau/cs/kieler/klighd/test/ViewContextSourceModelTrackingTest.java before doing any changes, and add further test cases justifying changes, if necessary. |
I got a simple KGraph that is drawn by KLighD:
At this point, the SourceModelTrackingAdapter contains mapping for all nodes shown to the source elements individually. Then I force an update using the IncremetalUpdateStrategy (for example by altering any diagram option). This causes the KGraphMerger of the incremental update to merge all properties from the new view model to the base view model, ultimately causing at SET notification for setting the model element of the new model to the base view model (which in this case is the just the same source element). That SET notification currently however removes the source model tracking adapter entirely from the shown base view model, removing also all mappings of the children. You are right, just reverting again will cause test10 to fail. I got two different solutions however which I wish you to review first:
Which one would you prefer @sailingKieler ? |
This would be indeed unfortunate. I tend to advocate option two, although I'm wondering why is the KGraphMerger setting those properties repeatedly if the values are identical? And why is the Adapter notified on "no-change" changes? |
It uses the copyProperties of the IPropertyHolder interface to copy all properties from the new element to the base element and therefore uses the EMapPropertyHolder implementation, which does not check if the value has already been set. This is also why the adapter is notified although the change does not do anything. So an alternative would be to check for equality there already. If you think that is better, I will make that change on master or as a pull request, as you wish. |
That would be great! :-) |
I created a PR for you to review, if you think there is anything we still have to do before merging, please comment. Otherwise I see this ticket to be fixed now. |
Does the change really fix this issue? |
I will add tests at some point, the incremental update caused mutiple problems over the time for me and I would myself like to see that in a stable and tested state. Currently I just needed a quick fix for myself, testing will be done more mid-term. |
I added a test that tests the exact scenario I had before and succeeds only with this fix. More tests for the incremental will follow later, but this at least confirms this fix can be merged into master. |
When updating a diagram with the incremental update, the SourceModelTrackingAdapter of the ViewContext breaks, the map used in the ViewContext:getSourceElement method only contains a single node. Somewhere in the last updates to the incremental update this must have confused the automatic adapter propagation that the mapping is not restored correctly anymore.
The text was updated successfully, but these errors were encountered: