|Re: Need explanation about getBeforeDestroyElementCommand and getBeforeDestroyDependentsCommand [message #1833777 is a reply to message #1833770]
||Fri, 23 October 2020 16:53
|| Christian Damus
Registered: July 2009
There are two different things happening here: recursive destruction of the model sub-tree and destroy-dependents.
The operations are being destroyed because the GMF run-time, when destroying the interface, recursively destroys the entire sub-tree rooted at that interface from the bottom up. That is why you see that first, for each operation, the interface that owns it is asked for destroy advice and also the operation itself is asked for destroy-dependents advice. Only after the sub-tree is processed (here being only the operations), then the interface edit-helper is asked for advice to destroy its dependents.
What you don't see is the edit-helper for the interface's owner (maybe a package) being asked for advice in destruction of the interface, because I guess you didn't put printfs in that.
So, I think that perhaps what was confusing you was that destruction proceeds recursively bottom-up and the owner of an element is asked how to destroy that element, not the element, itself. This aligns with the owner of an element being asked how to add a new owned element to itself.
It is worth mentioning, perhaps, that the sub-tree of the object being destroyed are all implicitly (structural) dependents and so don't need to be covered by the destroy-dependents advice. It is primarily intended for objects related "side-ways" in the model by arbitrarily complex means.
Powered by FUDForum
. Page generated in 0.02599 seconds