以编程方式运行 EMF 代码生成
我创建了一个扩展名为 .system
的 EMF 模型,它将为我的工作生成代码。
现在我可以使用 Eclipse 中的启动代码生成操作来生成代码。但我想通过从独立程序启动代码生成来生成代码。
我该如何实现这一目标?
详细信息:我已经从 EMF 模型创建了一个插件,并将其包含在 Eclipse 中。
我将从我的插件中创建 .system
文件,并且我可以从我的插件生成代码。
我观察到,当我单击启动代码生成时,它会从我的插件启动一个 LauchAction
类。
如何从独立的 Java 程序启动我的 LaunchAction
类?
我的目标是运行我创建的 .system
模型并从独立的 Java 程序生成代码。
我该如何实现这一目标?
I have created an EMF model with extension .system
which will generate the code for my work.
Now I can generate code using launch code generation action from Eclipse. But I want to generate the code by launching the code generation from a stand-alone program.
How do I achieve this?
Details: I have created a plugin from EMF model and have inlcluded in the Eclipse.
I will created .system
files from out of my plugin and I can generate code from my plugins.
I have observed that when I click launch the code generation it is starting a LauchAction
class from my plugin.
How do I start my LaunchAction
class from a stand-alone Java program?
My aim is to run my created .system
model and generate the code from a stand-alone Java program.
How do I achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以从命令行调用 Eclipse。与此类似:
此命令将静默启动 Eclipse 并生成模式代码 (
-model
)、编辑插件 (-edit
)、编辑器插件 (< code>-editor)和测试插件(-tests
)。如果不需要,请忽略这些参数中的任何一个。You could call Eclipse from the command line. Something similar to this:
This command will start Eclipse silently and will generate mode code (
-model
), edit plug-in (-edit
), editor plug-in (-editor
), and the test plug-in (-tests
). Leave out any of these parameters if they are not needed.我不知道如何解决你的问题,但我认为这是可行的。我认为你必须查看 EMF 源代码来检查代码生成是如何工作的。
以下是一些起点:
如果您有 PDE 和 EMF 工具,请使用“导入”>插件和片段,用于将 EMF 插件添加到您的 Eclipse 工作区中。
否则,克隆并导入以下 Git 存储库:
<前><代码>https://git.eclipse.org/c/emf/org.eclipse.emf.git/
看看以下文件,也许您可以在那里找到您需要的内容:
否则,看看
org.eclipse.emf.codegen.ecore
插件.祝你好运!这是一个有趣的问题!如果您解决了,请回来报告!
编辑: 哦,这个问题已经有 10 年历史了,我没有注意到!
I don't know how to solve your problem, but I think it is doable. I think you have to look at the EMF source code to check how the code generation works.
Here are some starting points:
If you have PDE and the EMF tools, use use Import > Plug-ins and Fragments to get the EMF plugin into your Eclipse workspace.
Otherwise, clone and import the following Git repository:
Have a look at the following file, maybe you can find what you need there:
Otherwise, look in the
org.eclipse.emf.codegen.ecore
plugin.Good luck! It's an interesting problem! Please report back here if you solve it!
EDIT: Ops, this question is 10 years old, I didn't notice!