Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Add GenModel option for platform scheme-aware URIs in XXXEditor.doSave()
Add GenModel option for platform scheme-aware URIs in XXXEditor.doSave() [message #667962] Tue, 03 May 2011 04:23 Go to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
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 #668010 is a reply to message #667962] Tue, 03 May 2011 11:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30366
Registered: July 2009
Senior Member
Jevon,

Comments below.

Jevon Wright wrote:
> 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)?
You should add it to your resource factory. If you don't already have
one, you can generate one (and remember that the plugin.xml doesn't
update unless you delete it).
>
> 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 #1387859 is a reply to message #668010] Wed, 25 June 2014 17:49 Go to previous messageGo to next message
Fazi G is currently offline Fazi GFriend
Messages: 1
Registered: June 2014
Junior Member
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
Re: Add GenModel option for platform scheme-aware URIs in XXXEditor.doSave() [message #1388144 is a reply to message #1387859] Thu, 26 June 2014 03:43 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30366
Registered: July 2009
Senior Member
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
Previous Topic:EMF Model: Listen to changes when modified by other Eclipse
Next Topic:[CDO] starnge error after aproximately 200 requests to db
Goto Forum:
  


Current Time: Thu Aug 22 22:39:13 GMT 2019

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

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

Back to the top