|
Re: Code for Model created in Sirius editor [message #1815132 is a reply to message #1815121] |
Wed, 25 September 2019 19:22 |
Emmanuel Chebbi Messages: 123 Registered: February 2018 |
Senior Member |
|
|
Hi,
I am not sure about what you are trying to achieve.
a) If you want the Java code corresponding to the concepts defined in your metamodel you can generate it from your .genmodel file [1].
b) If you want to generate some code (Java, XML, JSON or whatever suits your needs) from the model defined with your Sirius editor then you'll have to write the generator yourself [2, 3].
c) If you want to manipulate Java instances that correspond to the model defined with your Sirius editor, then you have to:
- Generate the Java code from your metamodel [1],
- Load your model from the file in which it is stored.
Regarding this "model file". When you use the Sirius editor to edit your system model you should notice that your project contains at least two files:
- a representations.aird file, which is used by Sirius to store informations about how your model is shown. In other words, this file does not contain any information about your model itself, just data about how the diagram should be displayed,
- a model file, which actually defines the content of your model. Usually the extension of this file is the name of your metamodel. For instance, if you have a file named system.ecore then it's likely that the model file will be called something.system. Otherwise, I believe that the xmi extension is used by default. [4] shows how to create a new model file and [5] shows how to create a new Sirius representation from a model file.
Once you have determined the model file, [6] shows how you can turn it into a Java instance.
Hope that helps.
Regards,
Emmanuel
[1] https://www.vogella.com/tutorials/EclipseEMF/article.html#generating-java-code
[2] https://www.eclipse.org/forums/index.php/t/1100409/
[3] https://www.eclipse.org/forums/index.php/t/1100361/
[4] https://www.vogella.com/tutorials/EclipseEMF/article.html#create-your-model
[5] https://wiki.eclipse.org/Sirius/Tutorials/StarterTutorial#Via_the_Model_Explorer
[6] https://www.vogella.com/tutorials/EclipseEMF/article.html#load-an-existing-model
[Updated on: Wed, 25 September 2019 20:00] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03444 seconds