Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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)
Resolving package URI from workspace plugin with E4 model editor [message #1793829] Thu, 16 August 2018 16:07 Go to next message
Elias Vasylenko is currently offline Elias VasylenkoFriend
Messages: 19
Registered: December 2015
Junior Member
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:

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.saiman.co.uk/eclipse/2018/UISaiman/ui' not found. (platform:/resource/uk.co.saiman.msapex/Application.e4xmi, 44, 112)


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?

[Updated on: Thu, 16 August 2018 16:11]

Report message to a moderator

Re: Resolving package URI from workspace plugin with E4 model editor [message #1793837 is a reply to message #1793829] Thu, 16 August 2018 17:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29653
Registered: July 2009
Senior Member
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...
Re: Resolving package URI from workspace plugin with E4 model editor [message #1793844 is a reply to message #1793837] Fri, 17 August 2018 06:58 Go to previous messageGo to next message
Elias Vasylenko is currently offline Elias VasylenkoFriend
Messages: 19
Registered: December 2015
Junior Member
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...

Well I'll have an explore, thanks for the help.
Re: Resolving package URI from workspace plugin with E4 model editor [message #1793845 is a reply to message #1793844] Fri, 17 August 2018 07:15 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

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.

Regards

Ed Willink
Re: Resolving package URI from workspace plugin with E4 model editor [message #1793852 is a reply to message #1793845] Fri, 17 August 2018 09:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29653
Registered: July 2009
Senior Member
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.

https://ci.eclipse.org/emf/

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...
Previous Topic:NoClassDefFoundError - org.eclipse.emf.ecore.change jar - Maven - Eclipse
Next Topic:Modify the element's attribute (Att1) when the element's (Att2) changes
Goto Forum:
  


Current Time: Fri Nov 16 18:08:05 GMT 2018

Powered by FUDForum. Page generated in 0.02283 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top