Referenced model in a jar [message #1829757] |
Fri, 10 July 2020 09:14 |
Wernke zur Borg Messages: 42 Registered: December 2011 |
Member |
|
|
I need to maintain an RCP application with an Ecore model B that is an extension of an external model A.
Model A does not exist in my workspace but in an external bundle that is in my Plug-In Dependencies. This bundle is currently not built as an Eclipse plug-in, because it is designed to run in a non-Eclipse environment. It has a Manifest and contains the *.ecore files and the genmodel in a model folder but there is no plugin.xml.
So far we have applied a workaround by copying the *.ecore files of model A out of the jar into the model folder of model B. This way we could easily create references from B to A since they were in the same folder. Then we only generate the code for model B, and at runtime the references are properly resolved to the external bundle. So far so good (or bad).
This is not a nice approach, and we are facing the second plug-in that would need to do the same copying.
I have been trying to add a plugin.xml to the external bundle with extensions to "org.eclipse.emf.ecore.generated_package", but still at genmodel load time of model B EMF cannot find the genmodel or the ecore files of model A.
What is the "correct" way of extending an Ecore model that is not in your workspace but only lives in a plug-in dependency jar?
Thank you for any hints.
Wernke
[Updated on: Fri, 10 July 2020 09:40] Report message to a moderator
|
|
|
|
|
|
Re: Referenced model in a jar [message #1829778 is a reply to message #1829765] |
Fri, 10 July 2020 12:46 |
Wernke zur Borg Messages: 42 Registered: December 2011 |
Member |
|
|
Thank you @ the other Ed for your reply as well.
To get started I extracted the external model into a workspace plug-in project and manually changed all references in my Ecore model to platform:/resource URIs. I can then load the genmodel, but EMF converts the references back to relative workspace paths. Of course, when I then close the external model plug-in project, the genmodel can no longer be loaded since the path does not exist.
In the genmodel Reload dialog I can only specify workspace locations for referenced genmodels. How could I ever specify a platform:/plugin reference? Or asked differently, how would a "correct" reference to a platform:/plugin resource look like in the Ecore file, e.g. in a eSuperTypes definition?
My problem is the migration from a relative path to a plugin reference at modelling time (runtime is not the problem).
[Updated on: Fri, 10 July 2020 12:50] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Referenced model in a jar [message #1829894 is a reply to message #1829893] |
Mon, 13 July 2020 13:44 |
Wernke zur Borg Messages: 42 Registered: December 2011 |
Member |
|
|
I will do that.
There is no exception on selecting the package from the package list.
The exception on pressing OK after filling the resource manually was shown in a previous post above, repeated here:
!ENTRY org.eclipse.emf.edit.ui 2 0 2020-07-13 14:42:50.127
!MESSAGE org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
!STACK 0
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.emf.edit.ui.action.LoadResourceAction$LoadResourceDialog.processResources(LoadResourceAction.java:136)
at org.eclipse.emf.common.ui.dialogs.ResourceDialog.okPressed(ResourceDialog.java:372)
at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:468)
at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor$ExtendedLoadResourceAction.run(EcoreActionBarContributor.java:135)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:413)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:330)
at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:204)
at org.eclipse.core.internal.resources.File.getContents(File.java:273)
at org.eclipse.core.internal.resources.File.getContents(File.java:266)
at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:207)
at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:525)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1314)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 44 more
Caused by: java.lang.Exception: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
... 54 more
[Updated on: Mon, 13 July 2020 13:46] Report message to a moderator
|
|
|
|
|
Re: Referenced model in a jar [SOLVED] [message #1829927 is a reply to message #1829922] |
Tue, 14 July 2020 09:04 |
Wernke zur Borg Messages: 42 Registered: December 2011 |
Member |
|
|
So my debugging session was successful, the problem is solved. It was all my fault.
I had made two mistakes:
1. The plugin.xml in my own plug-in contained old generated entries for the generated_package extension point, from the time the external model had been copied into it.
EMF displayed the packages from the wrong plug-in, from which the model could not be loaded. After fixing this, the external packages were no longer listed, so some added consistency at this point.
2. The modified MANIFEST in the external plug-in had the "singleton:=true" in the wrong entry. It has to go after the Bundle-SymbolicName but was after the Bundle-Name. Things will not work when it is missing.
This caused PDE to fail registering the external plug-in as contributing to the generated_package extension point. After fixing this everything is working. Copying the external model is history.
Thank you so much @Ed for your patient support in this forum. You are incredibly helpful, please keep up this good work.
Wernke
[Updated on: Tue, 14 July 2020 09:11] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04892 seconds