Breadcrumbs

Home » Modeling » EMF » Resolving package URI from workspace plugin with E4 model editor(I have an emf model extending the E4 application model and want to be able to resolve it from within the model editor in Eclipse)

I have an emf model which extends the E4 application model with a couple of new MUIElements. If I add the project containing the model to my target platform and launch a new Eclipse instance it works fine, and I can reference the new element from an .e4xmi editor in the new instance.

(There is no editor registered for it yet, it just shows the default (unknown model element) but this is fine, I'm happy to edit the XMI directly for now.)

So I can resolve the model extensions if the plugin is contained in the *running instance*, but this isn't very useful for me. I want to be able to resolve them when the plugin is in the *current workspace*.

Looking at the few discussions & examples I can find around the internet it seems that it should be possible, but I can't get it to work. I'm getting the following exception:

I wasn't sure if it would be best to post this under EMF or E4, apologies if this is the wrong place.

Edit: it may be important that I'm using Bndtools not e.g. Tycho to build the project. I copied the manifest to META-INF/MANIFEST.MF in the project directory and this seemed sufficient for Eclipse to recognise it as a plugin project, and again this allows it to be resolved into the target platform and run in a new instance just fine. How does Eclipse resolve emf models from the workspace?

You need to install your extension model in the IDE for it to work in that IDE. If you can do a build of it to produce a p2 update site, you can install from that into the IDE. I use this same "trick" with EMF. E.g., I change the GenModel and enhance the generator and then I want to regenerate the EMF's own models in my running IDE using those new features. So I do a local Tycho build to produce an update site, and then I use that update site to install into my current IDE; kind of a cool bootstrap process...

Ah okay I see, I was worried that might be the case after all. This does somewhat complicate the process of setting up a usable development environment for new contributors.

Also I wonder if it's possible to add a single plugin once which then scrapes the workspace/target-platform to register emf extensions dynamically? Perhaps it is necessary to publish them statically and this is not possible...

If you want to use extra Java classes installing is the best option, but if you only need the models, using platform:/resource references can work.

Have you used XMLResource.OPTION_SCHEMA_LOCATION to reference your metamodel? Perhaps XMLResource.OPTION_SCHEMA_LOCATION_IMPLEMENTATION might help, it can reference Java but I've never really understood how, why or when.

If everything you're testing works without the generated model's actual code being needed, i.e., it works with a dynamic model, that you could make use of that capability. But of course if your generated code is needed, the compiled byte code needs to be in the running IDE.

As for setting up a usable environment, consider how easy it is to set of an EMF development environment.

In that automatically setup environment, there is an external tools launch configure to do the Tycho build. And once that build is finished, it's trivial to create a p2 task on the installation setup to install the EMF SDK into the IDE. Though it seems to me in general one normally expects to need to launch a runtime application in order to test the code in your development environment, and that this self-boostrapping scenario is kind of a rare requirement...