Can I reuse ECore models by importing them into other models?
Asked Answered
I

2

8

I have multiple Ecore files for different purposes. I am now developing a tool which uses multiple models.

Can I develop an ECore model which references other models? 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?

Initiatory answered 21/2, 2012 at 20:40 Comment(0)
H
12

To reference one Ecore model from another:

  1. Open the model needing the added reference in the Ecore model editor. In your example, open the file 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.Sample Ecore model
  3. Select "Load Resource", then browse the workspace to find the Ecore file you want to include. In your example, open the file A.ecore or B.ecore.
Hutton answered 5/3, 2012 at 18:56 Comment(1)
Thanks, this would help others too, certainly a better explanation then mine :)Initiatory
I
2

Loading a resource in the ECore editor lets you import other models. Once loaded, the types from other model can be used in the first model.

Initiatory answered 21/2, 2012 at 23:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.