Serializing the model diagram as XML #526
-
Hi, I am referring the Workflow Diagram Example to work on my custom use-case. I could add new element in the ecore file, generate genmodel and the necessary classes based off the ecore file. I could also have the new element rendered on the Theia integrated client. Server code downloaded from the following URL: https://github.com/eclipse-glsp/glsp-server Currently, the diagram that would be drawn on the Theia client is serialized as JSON when viewed via the Code Editor. What changes needs to be done in order for the diagram to be serialized as XML? I tried referring the coffee-editor example, since it serializes the diagram as XML, however, I couldn't quite get a grasp of what is done there, since the classes being used in the coffee-editor's Guice module cannot be referenced from within an IDE..! Please refer this chat from my another question on the same topic (eclipse-emfcloud/emfcloud#110 (reply in thread)). I got some idea on what needs to be done for changing the serialization method. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, You would have to overwrite the registered Model Source Loader and Save Action Handler (which is bound in the super class of the linked method). Please be aware that the usual approach is as follows: In the workflow example, things are a bit simplified. The GModel is used directly as original source model. So the model source loader directly loads the JSON GModel into the model state and there is no translation into a GModel going on, as it already is the source model. I hope that helps! |
Beta Was this translation helpful? Give feedback.
Hi,
You would have to overwrite the registered Model Source Loader and Save Action Handler (which is bound in the super class of the linked method).
Please be aware that the usual approach is as follows:
You have a source model, whatever that is in your use case, e.g. a XML.
You load that in the Model Source Loader implementation and put it into the Model State.
In your registered implementation of the GModelFactory, this source model is translated at runtime into a GModel that represents the diagram to be rendered. This GModel is sent from the server to the client and will be rendered there.
When diagram editor users perform a change operation, your operation handlers on the server are i…