简体   繁体   English

我可以通过将ECore模型导入其他模型来重用它们吗?

[英]Can I reuse ECore models by importing them into other models?

I have multiple Ecore files for different purposes. 我有多个Ecore文件用于不同的目的。 I am now developing a tool which uses multiple models. 我现在正在开发一个使用多个模型的工具。

Can I develop an ECore model which references other models? 我可以开发一个引用其他模型的ECore模型吗? For example when I have A.Ecore and B.Ecore, how can I create a C.Ecore, in which I have attributes with types from A.Ecore or B.Ecore? 例如,当我有A.Ecore和B.Ecore时,如何创建一个C.Ecore,其中我有A.Ecore或B.Ecore类型的属性?

To reference one Ecore model from another: 从另一个引用一个Ecore模型:

  1. Open the model needing the added reference in the Ecore model editor. 在Ecore模型编辑器中打开需要添加引用的模型。 In your example, open the file C.ecore . 在您的示例中,打开文件C.ecore
  2. Right click on the top item in the editor. 右键单击编辑器中的顶部项目。 In the below example, you would click on the platform:/resource.../webpage.ecore item. 在下面的示例中,您将单击platform:/resource.../webpage.ecore项。 样本Ecore模型
  3. Select "Load Resource", then browse the workspace to find the Ecore file you want to include. 选择“加载资源”,然后浏览工作区以查找要包含的Ecore文件。 In your example, open the file A.ecore or B.ecore . 在您的示例中,打开文件A.ecoreB.ecore

Loading a resource in the ECore editor lets you import other models. 在ECore编辑器中加载资源可以导入其他模型。 Once loaded, the types from other model can be used in the first model. 加载后,可以在第一个模型中使用其他模型中的类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM