How to programmtically be notified when an element in a sumodel have been manually loaded/resolved. [message #1786378] |
Wed, 02 May 2018 10:07 |
|
I am trying to be notified when an element in a submodel is being loaded manually using the context menu entry "Load" in Model Explorer view.
I have added a ResourceSetListener without any filter to the editing domain. This listener is notified when an element is being loaded. But at the time for notification, the element to be loaded does not seems to have been completely resolved as the Owner reference is not yet set, e.g. the method element.getOwner() returns null.
Is there an alternative for how to get notification when an element in a submodel is loaded at the time where it has been completely resolved including the owner reference being set?
/Thomas
|
|
|
Re: How to programmtically be notified when an element in a sumodel have been manually loaded/resolv [message #1786381 is a reply to message #1786378] |
Wed, 02 May 2018 12:01 |
|
Hi, Thomas,
I think this probably indicates a bug in Papyrus. The command that loads a sub-model unit should perform that in a transaction (a read-only transaction would suffice), so that all notifications to ResourceSetListeners will be batched until after the entire operation has completed, including the resolution of that containment proxy that sets up the linkage to the parent model unit. The reason why you're getting notification of the sub-model resource being loaded before the connection to the parent is made is because in the absence of the transaction context, every notification from the EMF run-time is dispatched individually to listeners.
I don't know of any other mechanism by which you can be notified that sub-models are being loaded, unless perhaps there's something in the Eclipse Command Handlers framework that can notify you about command execution (as from the menu action).
Cheers,
Christian
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02777 seconds