将 JET 模板集成到 EMF-GMF 插件
我创建了一个插件,可以让我对 JSF 应用程序进行建模。我使用 Emfatic、Ecore、EMF、GMF 创建它。
现在我的工作区中有 5 个项目: 我的应用程序 myapp.图 myapp.编辑 myapp.editor myapp.tests
如果我将 myapp 作为 Eclipse 应用程序运行,我可以根据元模型绘制/设计一个 .myapp_diagram。 现在我想知道如何将 JET 模板与我这里的内容集成。 我有图表,我知道如何构建 JET 模板,我只是想知道如何将图表作为 JET 寺庙的输入,以便生成代码。
到目前为止我所做的是将“myapp”项目转换为 JET 项目并编写模板文件。但如果我现在运行“myapp”并绘制图表,则没有生成代码按钮/选项。
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 can 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,基于 Eclipse 的建模项目都没有提供“生成代码”按钮。有多种可能的模型源和代码生成平台(JET、OAW、Xpand),因此您必须自己实现按钮和相关源代码。然而,这个过程相当简单。
一种方法是实现 org.eclipse.ui.popupMenus 扩展点,然后该扩展点调用生成代码所需的 Java 类。
例如,您可以查看
plugin.xml
在 IAML 项目中使用,使用 openArchitectureWare (OAW) 生成 PHP/Javascript 源代码 模板。相关的 Eclipse 操作是 GenerateCodeAction - 查看方法doExecute()
。希望这有帮助:)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 methoddoExecute()
. Hope this helps :)