|
Re: [Xpand] unresolved proxy referincing a model with "platform:/plugin/..." schema [message #513195 is a reply to message #513190] |
Tue, 09 February 2010 10:27 |
|
Since MWE does not run in an OSGi environment plugin URIs are not known. They have to be mapped to resource URIs, and you need the underlying .ecore file for this accessible (also) as resource.
The mapping is done in the StandaloneSetup like follows:
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri="${runtimeProject}/..">
<uriMap from="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore" to="platform:/resource/fast.encoder.dsl.dsl/model/Ecore.ecore" />
</bean>
Regards,
~Karsten
Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
|
|
|
|
Re: [Xpand] unresolved proxy referincing a model with "platform:/plugin/..." schema [message #513316 is a reply to message #513213] |
Tue, 09 February 2010 18:17 |
Mauro Antonaci Messages: 12 Registered: February 2010 |
Junior Member |
|
|
Thanks, your answers are very useful for me to understand better my problem: I did not know this limitation on plugin URI.
The first suggestion (by Karsten) requires the presence of the sub-model in the workspace (so that it can be found after the uri-mapping), and this violates our main constraint ("hide the sub-model inside the plugin!"). If we could remove this constraint, we could reference sub-model as a workspace resource so the uri mapping would be no more needed and all will work fine, but unfortunately we can't.
The refined suggestion (by Ed), seems to work (with some extra trick) and is compliant with our main constraint, because there is no need to copy sub-model into the workspace, but it can be referenced as plugin uri (with each plugin uri remapped to jar resource):
<uriMap from="platform:/plugin/<plugin name>/<path to submodel inside plugin>" to="jar:file:/<full path to plugin directory>/<jar name_xyz>.jar!/<path to submodel inside plugin>" />
The extra trick needed is that, even if the EMF editor shows the included resource as "platform/plugin/.." looking in the source code we found an unexpected behavior: the editor resolved the plugin uri to a relative path (with a lot of "../.." depending on the relative position between the workspace and the eclipse installation):
...
<panelDef href="../../../../../../../plugin/misctestcrt/model/pdefplugin/pdefplugin/mypdef.guigen#/"/>
...
and this is obviously not good (and does not work). But reverting by hand (with a text editor) the href to the original plugin uri, the Ed's solution works fine.
So a big step forward is done: thanks.
Now my next problem is: find a better (more portable) way to specify in the oaw file the path of the plugin jar in the right side of the URI mapping. I will try one of the following:
1) define a workflow property like ${eclipse_home} and using it in the remapped uri
2) subclass the StandaloneSetup class so it puts automatically all the uri mapping needed (if I will be able to do some discovery on referenced plugins, I don't know if it's possibile/easy in a running oaw-workflow).
Thank you for your help!
|
|
|
Re: [Xpand] unresolved proxy referincing a model with "platform:/plugin/..." schema [message #513339 is a reply to message #513316] |
Tue, 09 February 2010 19:16 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Mauro,
The recent posting from today in the EMF newsgroup about "Persisting
loaded resources across two models - pathmap is lost" might be useful
for you to understand how relative paths are produced or controlled.
Mauro wrote:
> Thanks, your answers are very useful for me to understand better my
> problem: I did not know this limitation on plugin URI.
> The first suggestion (by Karsten) requires the presence of the
> sub-model in the workspace (so that it can be found after the
> uri-mapping), and this violates our main constraint ("hide the
> sub-model inside the plugin!"). If we could remove this constraint, we
> could reference sub-model as a workspace resource so the uri mapping
> would be no more needed and all will work fine, but unfortunately we
> can't.
>
> The refined suggestion (by Ed), seems to work (with some extra trick)
> and is compliant with our main constraint, because there is no need to
> copy sub-model into the workspace, but it can be referenced as plugin
> uri (with each plugin uri remapped to jar resource):
>
>
> <uriMap from="platform:/plugin/<plugin name>/<path to submodel inside
> plugin>" to="jar:file:/<full path to plugin directory>/<jar
> name_xyz>.jar!/<path to submodel inside plugin>" />
>
>
> The extra trick needed is that, even if the EMF editor shows the
> included resource as "platform/plugin/.." looking in the source code
> we found an unexpected behavior: the editor resolved the plugin uri to
> a relative path (with a lot of "../.." depending on the relative
> position between the workspace and the eclipse installation):
>
>
> ..
> <panelDef
> href=" ../../../../../../../plugin/misctestcrt/model/pdefplugin/pde fplugin/mypdef.guigen#/ "/>
>
> ..
>
>
> and this is obviously not good (and does not work). But reverting by
> hand (with a text editor) the href to the original plugin uri, the
> Ed's solution works fine.
>
> So a big step forward is done: thanks.
>
> Now my next problem is: find a better (more portable) way to specify
> in the oaw file the path of the plugin jar in the right side of the
> URI mapping. I will try one of the following:
> 1) define a workflow property like ${eclipse_home} and using it in the
> remapped uri
> 2) subclass the StandaloneSetup class so it puts automatically all the
> uri mapping needed (if I will be able to do some discovery on
> referenced plugins, I don't know if it's possibile/easy in a running
> oaw-workflow).
>
> Thank you for your help!
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03022 seconds