Add GenModel option for platform scheme-aware URIs in XXXEditor.doSave() [message #667962] |
Tue, 03 May 2011 00:23  |
Eclipse User |
|
|
|
Hi,
For the second time I have been hit with the issue where, by default,
EMF-generated editors do not save model instances by default with
platform scheme-aware URIs.
http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg3 7443.html
That is, in doSave() I need to manually add the following line to
saveOptions:
saveOptions.put(XMLResource.OPTION_URI_HANDLER, new
URIHandlerImpl.PlatformSchemeAware());
Since I can't see any way to hook into the Editor.javajet to add this
option to doSave(), would it be possible to add this as a generation
option to the .genmodel metamodel -- e.g.
Editor.saveAsPlatformSchemeAwareURIs = boolean (default false)?
Or is there another way that I could do this without having to edit the
generated XXXEditor code manually? A dynamic template would be perfect.
Thanks
Jevon
|
|
|
|
|
Re: Add GenModel option for platform scheme-aware URIs in XXXEditor.doSave() [message #1388144 is a reply to message #1387859] |
Wed, 25 June 2014 23:43  |
Eclipse User |
|
|
|
Fazi,
In your GenPackage, you can set the Resource Type to, for example, XMI",
and then a resource factory will be generated and registered. In there
you can control the options specifically designed for model's
resources. Set a breakpoint in your factor to be sure it's being used,
and set a breakpoint in your XMI URLHandler implementation to ensure
it's getting called. Note that the implementation you say your using
does not do what you stated you want, this implementation ensures that
you won't get relative platforms between platform:/resource and
platform:/plugin URIs, so you'll need to implement one yourself.
On 25/06/2014 8:09 PM, Fazi G wrote:
> Hi,
>
> I have the same problem in saving my EMF models. More specifically,
> when saving my model files, which contain references to other
> resources, I want to have only platform resource URIs and not relative
> URIs.
>
> 1. I have added the saveOptions to my XXXEditor.doSave(), but nothing
> is still changed and I still have the relative URIs in my model file.
> 2. About Ed's reply, what should I add to the resource factory? And
> how can I generate one?
>
> Thanks,
> Fazi
|
|
|
Powered by
FUDForum. Page generated in 0.03480 seconds