Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Resource Factories/Resources
Resource Factories/Resources [message #423327] Sun, 28 September 2008 10:13 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

as i understand the mechanism of Resources and their corresponding
factories, one has to use the same ResourceFactory for loading a model, that
has been registered for serializing a model. I also know, that the kind of
Resource, which should be used for serializing the model from within the
generated wizard, can be selected in the properties of the genmodel. I have
made some experiences with the programatically variant of loading and
serializing an emf model, either by using a specific implementation of an
ResourceFactory. So, from this point of view, i have no question.

But now a new scenario (anyway, it is new for me): How is it possible, to
propagate a special ResourceFactory/Resource for the EMF Editor plugin? You
know, i want to do some optional settings and modifications (like
implementing the generateUUID() method, that it returns true) and i want the
Editor to use this ResourceFactory/Resource for serialization instead of a
default one. I searched for extension points concerning resources, but
didn't found anything.

Thanks for any help.
Timothy
Re: Resource Factories/Resources [message #423328 is a reply to message #423327] Sun, 28 September 2008 11:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31485
Registered: July 2009
Senior Member
Timothy,

Comments below.


Timothy Marc wrote:
> Hi all,
>
> as i understand the mechanism of Resources and their corresponding
> factories, one has to use the same ResourceFactory for loading a model, that
> has been registered for serializing a model.
Yes, that's generally a good idea.
> I also know, that the kind of
> Resource, which should be used for serializing the model from within the
> generated wizard, can be selected in the properties of the genmodel.
Yes, there's even more control over details like the file extension(s)
and whether a content type should be associated with those extensions or
whether a content type should just be assumed for the extension...
> I have
> made some experiences with the programatically variant of loading and
> serializing an emf model, either by using a specific implementation of an
> ResourceFactory. So, from this point of view, i have no question.
>
> But now a new scenario (anyway, it is new for me): How is it possible, to
> propagate a special ResourceFactory/Resource for the EMF Editor plugin?
Propagate?
> You
> know, i want to do some optional settings and modifications (like
> implementing the generateUUID() method, that it returns true) and i want the
> Editor to use this ResourceFactory/Resource for serialization instead of a
> default one.
The resource factory registration is typically done in the plugin.xml of
the model, but since the plugin.xml doesn't regenerate, changing
Generator options which affect the plugin.xml requires deleting the
plugin.xml and then regenerating it for the new options.
> I searched for extension points concerning resources, but
> didn't found anything.
>
Look for org.eclipse.emf.ecore.extension_parser and
org.eclipse.emf.ecore.content_parser, and keep in mind that
extension_parsers must identity a unique extension whereas a
content_parser allows many different models to use the same
extension... Editors can similarly be associated with either an
extension or a content type. (And as I mentioned, you can configure
this via the GenPackage's options, with the caveat that plugin.xmls
don't regeneration once they exist.)
> Thanks for any help.
> Timothy
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Resource Factories/Resources [message #423329 is a reply to message #423328] Sun, 28 September 2008 12:09 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Ed,
propagate was not the correct word :) I think, i should have used the word
"declare".
And again, thanks for your answers.
Thx
Timothx
"Ed Merks" <Ed.Merks@gmail.com> schrieb im Newsbeitrag
news:gbnq12$1uc$1@build.eclipse.org...
> Timothy,
>
> Comments below.
>
>
> Timothy Marc wrote:
>> Hi all,
>>
>> as i understand the mechanism of Resources and their corresponding
>> factories, one has to use the same ResourceFactory for loading a model,
>> that has been registered for serializing a model.
> Yes, that's generally a good idea.
>> I also know, that the kind of Resource, which should be used for
>> serializing the model from within the generated wizard, can be selected
>> in the properties of the genmodel.
> Yes, there's even more control over details like the file extension(s) and
> whether a content type should be associated with those extensions or
> whether a content type should just be assumed for the extension...
>> I have made some experiences with the programatically variant of loading
>> and serializing an emf model, either by using a specific implementation
>> of an ResourceFactory. So, from this point of view, i have no question.
>>
>> But now a new scenario (anyway, it is new for me): How is it possible, to
>> propagate a special ResourceFactory/Resource for the EMF Editor plugin?
> Propagate?
>> You know, i want to do some optional settings and modifications (like
>> implementing the generateUUID() method, that it returns true) and i want
>> the Editor to use this ResourceFactory/Resource for serialization instead
>> of a default one.
> The resource factory registration is typically done in the plugin.xml of
> the model, but since the plugin.xml doesn't regenerate, changing Generator
> options which affect the plugin.xml requires deleting the plugin.xml and
> then regenerating it for the new options.
>> I searched for extension points concerning resources, but didn't found
>> anything.
>>
> Look for org.eclipse.emf.ecore.extension_parser and
> org.eclipse.emf.ecore.content_parser, and keep in mind that
> extension_parsers must identity a unique extension whereas a
> content_parser allows many different models to use the same extension...
> Editors can similarly be associated with either an extension or a content
> type. (And as I mentioned, you can configure this via the GenPackage's
> options, with the caveat that plugin.xmls don't regeneration once they
> exist.)
>> Thanks for any help.
>> Timothy
>>
>>
Previous Topic:CellModifier and CellEditor
Next Topic:modify generated code or subclass?
Goto Forum:
  


Current Time: Sun Sep 27 18:22:23 GMT 2020

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

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

Back to the top