|Deleting the root element from a child representation corrupts the session [message #1768912]
||Mon, 24 July 2017 21:29
| Chris Mamorella
Registered: June 2013
In my VSM I have:|
Diagram type A: semantic root element = parent
Diagram type B: semantic root element = child
Diagram B can be created and navigated to from Diagram A if "parent" contains "child".
If I delete "child" from within diagram A without creating or navigating to Diagram B, the semantic model is updated appropriately and everything works as expected. If, however, I create/navigate to diagram B and then later delete the "child" from the semantic model (change is triggered from an another view), I get the following error:
In my experience this error indicates a decoupling between the session and its resources. But I don't understand why this happens when a nested representation is created under the parent representation. I assumed that deleting the child from the semantic model would be gracefully handled by Sirius when multiple representations exist because other model add or change events seem to be handled ok. Even worse - when this delete error occurs it is not recoverable and the only resort is to shut down and start a new session.
Is there a "delete representation" command that I need to be using? I catch the "delete child" notification and promptly close the diagram editor before this NPE error occurs, but the outcome is unchanged.
[Updated on: Mon, 24 July 2017 21:32]
Report message to a moderator
|Re: Deleting the root element from a child representation corrupts the session [message #1768990 is a reply to message #1768982]
||Tue, 25 July 2017 13:33
|| Steve Monnier
Registered: May 2011
Indeed, the fact that you remove the child element in another editing domain is important. I removed the element out of Eclipse, using a text editor, and the representation did not close by itself. Furthermore, if I refreshed the modeling project and switch back to the child representation it threw some exception but not like yours.
As a matter of fact, when you delete the child semantic element, even in the same editing domain, the child representation is not deleted, only closed. In your case, DiagramDialectServices#deleteRepresentation may do the trick, but you may need org.eclipse.sirius.ui.business.api.dialect.DialectUIServices.closeEditor(IEditorPart, boolean) instead.
Steve Monnier - Obeo
Need training or professional services for Sirius?
Powered by FUDForum
. Page generated in 0.03255 seconds