What happens after DiagramDialectUIServices.openEditor? [message #1834440] |
Tue, 10 November 2020 12:18 |
Yufei Zhou Messages: 44 Registered: March 2020 |
Member |
|
|
Hi,
I am trying to create a element's representation programmatically by using the api org.eclipse.sirius.business.api.dialect.DialectManager.createRepresentation and DiagramDialectUIServices.openEditor. The api works fine and it indeed creates a diagram representation and opens it, but there's one thing strange. After I executed these methods and calls a session.save to save the current session, the opened diagram was momently saved, but after half or one second the diagram editor becomes dirty again, and a star sign(which indicates the diagram is not properly saved) appears on the editor page label.
I really wonder what happed after I called DiagramDialectUIServices.openEditor, why the editor was saved but turn dirty again? Who modified the diagram? Is there any way to make the diagram representation properly saved just after it was created and opened? It's kind of important to my application. Any hint or advice will helps.
Thanks for your help very much.
Yufei Zhou
[Updated on: Tue, 10 November 2020 12:31] Report message to a moderator
|
|
|
|
Re: What happens after DiagramDialectUIServices.openEditor? [message #1834549 is a reply to message #1834485] |
Thu, 12 November 2020 09:34 |
|
Hi,
Indeed, the first time a diagram is opened, an arrange all is automatically launched. To detect the first opening, an adapter is added (NotYetOpenedDiagramAdapter) by calling org.eclipse.sirius.diagram.business.internal.dialect.NotYetOpenedDiagramAdapter.markAsToArrange(DDiagram).
Before calling your opening action, you can remove this adapter:
if (targetDiagram.eAdapters().contains(NotYetOpenedDiagramAdapter.INSTANCE)) {
targetDiagram.eAdapters().remove(NotYetOpenedDiagramAdapter.INSTANCE);
}
Regards,
Florian
|
|
|
|
Powered by
FUDForum. Page generated in 0.02133 seconds