Page 1 of 1

Writing your own code generator for e.g., Activity Diagrams

PostPosted: Fri Jul 27, 2018 4:52 am
by MSDL
I am new to MagicDraw. I would like to write my own code generator, which is fully customized and can generate code for any model element I want. Currently the only option I see is to write a complete plug-in for this. Is that correct?
I would expect that code templates and a code generation language would be present (like e.g., Acceleo https://wiki.eclipse.org/Acceleo/Getting_Started), but I cannot seem to find this.

What is the best way to write your custom code generator? Thank you in advance!

(By the way, I am aware of the LieberLieber Embedded Engineer plug-in, but I am looking for custom-made code generation.)

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Tue Aug 14, 2018 4:09 am
by gedkvi
Hello,

Unfortunately, the Code Generation code is not exposed to OpenAPI, thus there is nothing to extend.
The only way would be to, like you mentioned, write a plug-in from scratch yourself.
Of course there are various profiles like XML Schema Profile, Java SE8 Model Library and other profiles that contain various profiles. They contain stereotypes, types and other information that might come in handy to you in your model. And you would not need to duplicate them by yourself. They can be found in the profiles or modelLibraries folders in the installation directory.

Sincerely,
No Magic Customer Support

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Fri Jan 25, 2019 12:24 pm
by stefan.roehrig@vaillant-group.com
Is it correct, that there is no way to customize the java code generation which is delivered with MagicDraw professional?

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Mon Jan 28, 2019 1:20 am
by gedkvi
stefan.roehrig@vaillant-group.com wrote:Is it correct, that there is no way to customize the java code generation which is delivered with MagicDraw professional?


Hello,

It is only as customizable as Options allow it.
If we are talking about customizing using code for extensability then yes, there is no way to customize the current implementations of java code generation. The API has methods to call code reverse/generate. So if a "post processing" mechanism would be enough for you, maybe that could be a solution.

Sincerely,
No Magic Customer Support

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Mon Jan 28, 2019 3:02 am
by stefan.roehrig@vaillant-group.com
Hi,
I'm really sad to hear this, because then I guess it is not possible for me to use it.
What I need is java code with special annotations in it and the generation of the OData service interface, which belongs to it.

Is there any 3rd party code generator which works together with MagicDraw?

Regards,
Stefan

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Mon Jan 28, 2019 6:49 am
by gedkvi
Hi,

Using current Java code generator it is possible to model annotations. You can read more about annotations in <modeling_tool>\manual\MagicDraw CodeEngineering UserGuide.pdf, maybe it could be of any use for you.
But unfortunately there is no way to plug into the reverse/generate process itself. and e.g. call different code when reversing methods.

Is there any 3rd party code generator which works together with MagicDraw?

I have not heard of such code generator for Java. Actually we don't have a repository and don't provide any 3rd party plugins. Sometimes users share code in the forums, but rarely a full plugin.

Sincerely,
No Magic Customer Support

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Wed Jun 12, 2019 3:26 am
by koffeekingston@protonmail.com
This code generator gets the solution and helps you to debug easily. https://errorcode0x.com/fixed-dell-printer-error-016-302/ helped me to with this annotation.

Re: Writing your own code generator for e.g., Activity Diagrams

PostPosted: Fri Sep 20, 2019 1:30 am
by sunitapr9091@gmail.com
Thanks for the post. It is helpful for me.