开发者

Integrate JET Templates to an EMF-GMF plugin

开发者 https://www.devze.com 2023-02-02 19:53 出处:网络
I created an plugin that lets me model JSF Applications. I created it using Emfatic, Ecore, EMF, GMF.

I created an plugin that lets me model JSF Applications. I created it using Emfatic, Ecore, EMF, GMF.

So now i have 5 projects in my workspace: myapp myapp.diagram myapp.edit myapp.editor myapp.tests

If i run myapp as a Eclipse Application i c开发者_运维技巧an draw/design a .myapp_diagram based on the meta-model. Now I want to know how can i integrate JET Templates with what i have here. I have the diagram, i know how to build JET Templates, i just want to know how can i feed the diagram as input to the JET temples so that code will be generated.

What i have done until now is convert the "myapp" project to JET Project and wrote the template files. But if i now run "myapp" and draw a diagram, theres nowhere a GENERATE CODE button/option.


Unfortunately none of the Eclipse-based modelling projects provide a "generate code" button. There are a wide range of possible model sources and code generation platforms (JET, OAW, Xpand), so you will have to implement the button and the relevant source code yourself. However, the process is fairly straightforward.

One approach is to implement an org.eclipse.ui.popupMenus extension point, which then calls the Java class necessary to generate the code.

As an example, you can check out the plugin.xml used in the IAML project to generate PHP/Javascript source code, using openArchitectureWare (OAW) templates. The relevant Eclipse Action is GenerateCodeAction - check out the method doExecute(). Hope this helps :)

0

精彩评论

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