EMF External GenModel Reference Problem

If you are developing your own metamodel, EMF provides you the capability to reference elements from another meta model.
Later, when you try to generate java code for your meta model and according edit and editor plugins, you might get error messages when you open your EMF gen model as shown below.

When you take a look at your gen model in the tree editor view, which is still accessible by the generator tab of your gen model editor, you might notice, that the referenced meta model package does not have a link icon but a standard package icon. Compare the icon shown for ECore and shown for the Javaapplication package in the screenshot below.

To fix this issue, you should make right click on your gen model in the package explorer and choose reload…

In the wizard, we first select the ecore model importer. Clicking next might result in an error dialog because of the GenModel reference. This can be irgnored by clicking OK is fine. On the next wizard page, our own meta model ecore file should be presented as Model URI. Clicking Next will lead us to a wizard page that allows us to configure the rerefences to the external meta models.

On this page, we have to ensure the that the external meta models are selected in the lower area (Referenced gen models) and not in the upper area (Root packages).

Afterwards, we can confirm the page by clicking finish and our gen model should be fixed now.

Thanks to Michael Hauck for essentials hints when not to seeing the wood for the trees 😉

Leave a Comment