Deleting the root element from a child representation corrupts the session [message #1768912] |
Mon, 24 July 2017 21:29 |
Chris Mamorella Messages: 34 Registered: June 2013 |
Member |
|
|
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:
java.lang.NullPointerException
at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.getAllMandatoriesAdditionalLayers(DDiagramSynchronizer.java:343)
at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.activateNewMandatoryAdditionalLayers(DDiagramSynchronizer.java:310)
at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.refreshOperation(DDiagramSynchronizer.java:372)
at org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:355)
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:91)
at org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.refresh(DiagramDialectServices.java:254)
at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:123)
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 #1768969 is a reply to message #1768912] |
Tue, 25 July 2017 09:14 |
|
Hello,
In this scenario, where deleting a semantic element that is the root element of a different opened diagram, the expected behavior is to have a popup with the message "The root element has been deleted, the editor will close".
What version of Sirius are you using? The method where you have an exception does not exist anymore in Sirius 5.0. I tested in Sirius 4.1 where this method still existed and this scenario still works. Can you describe own the layers of your diagram description have been specified? Maybe there is an unexpected specification, but that seems unlikely.
Regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
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 |
|
Hello,
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.
Regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.03278 seconds