开发者

Converting a UML class diagram created using Papyrus into an .ecore file

开发者 https://www.devze.com 2023-03-07 23:34 出处:网络
Here is what I do using eclipse : Create a new Papyrus project Create a class diagram in Papyrus Create a new EMF empty project

Here is what I do using eclipse :

  1. Create a new Papyrus project
  2. Create a class diagram in Papyrus
  3. Create a new EMF empty project
  4. Use the EMF Generator Model to convert my .uml file (created with Papyrus) into an .ecore file

Now i would like to do that in Java. I found a post here where someone is doing it from XSD. I would like to do the same thing but from UML. User565300 is using something called Xsd2Ecore but I couldn't find a Uml2Ecore. Do you guys know what eclipse is using to conve开发者_高级运维rt UML file ?


I happened to bump into this problem very recently and found an easy solution so thought I would share.

In addition to Papyrus, I have the Obeo UML Designer 6.1 plugin installed.

1) UML Designer adds a concept of a "Modeling Project". Create one from the File->New submenu.

2) Find the Papyrus model you want to convert to ECore. Under its root node you will generally see two children labeled "notation" and "uml". The node labeled "uml" corresponds to a file called "model.uml". Click it and copy the file path to the clipboard.

3) Return to your Modeling Project. Paste your clipboard into it, and you should see "model .uml" appear. Open it.

4) Open the "root resource node" and select its single child, which will be referred to below as the "root model node". -- This should be a UML model object representing the root of the model you are porting. -- If you see something else, check whether you failed to overwrite a pre-existing file or copied the wrong model source .

5) Make sure you are on the Modeling perspective and see the "UML Editor" menu. With the root model node still highlighted, navigate to "Convert To" -> "Ecore Model..."

6) Complete the wizard. Correct any errors and reepat if necessary.

The Obeo Designer is an open source project available on GitHub, so I imagine its possible to pick apart the Manifest file to identify the menu contribution for "To Ecore..." and then locate the actual source code through GitHub.


Papyrus is an UML Editor which requires other plugins. You need to use another plugin such as accelero in order to generate code but to be honest it seems that since Eclipse 3.5 this plugin is not really working with the latest releases. The best would be to swap to Topcased which is modeling development environment including code generation. The only problem is that Topcased has been abandoned in order to be merged inside Papurus MDT so it is better not to invest in this tool today and stick to Papyrus MDT.

Creating ecore model from papyrus is impossible because it works with a GMF model and not directly from an Ecore model. GMF being also abandoned since Eclipse 3.5 I don't know what to say ... Good luck,

0

精彩评论

暂无评论...
验证码 换一张
取 消