Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF Serialization
GMF Serialization [message #168607] Thu, 17 January 2008 10:10 Go to next message
Eclipse UserFriend
Originally posted by: gomez.rhrk.uni-kl.de

Hello,

I am relative new with GMF development. Within our application it is
required to have more than one file format (not only XML). I know from
previous threads that it is possible to extend the class ResourceImpl in
order to implement a specific format, as is the case here:

https://bugs.eclipse.org/bugs/attachment.cgi?id=80321

What I do not know, is how to use such an implementation within the GMF
code. Is there a place in the generated code where I can define customized
resources that I will use in order to save and load my files? Do I have to
define these resource classes by using extension points?

If anyone of you knows about this, I will appreciate your help.

Thanks a lot!
Re: GMF Serialization [message #169086 is a reply to message #168607] Mon, 21 January 2008 11:27 Go to previous messageGo to next message
Eclipse UserFriend
Hello Carolina,

In EMF you can plug in custom Resource implementations using "org.eclipse.emf.ecore.extension_parser"
extension-point. This is all you need to let GMF-generated diagram storing
domain model information in the approptiate format.

-----------------
Alex Shatalin
Re: GMF Serialization [message #171675 is a reply to message #169086] Wed, 06 February 2008 09:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gomez.rhrk.uni-kl.de

Hello Alex,

Thank you for your answer. I added my custom resource implementation class
by using the "org.eclipse.emf.ecore.extension_parser" extension point of
my GMF project. But still my models are saved in the default format. Do
you know if there is something else that has to be done, so that my models
are saved in my custom format?

Thank you once more!

Carolina.
Re: GMF Serialization [message #171683 is a reply to message #171675] Wed, 06 February 2008 10:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello Carolina,

Nothing else. Just check "type" attribute specified in "org.eclipse.emf.ecore.extension_parser".
This should be extension for the model file(s). In addition you can place
a break-moint into your custom ResoruceFactory to see if it was called while
creating resrouce for the domain model.

-----------------
Alex Shatalin
Re: GMF Serialization [message #171817 is a reply to message #171683] Thu, 07 February 2008 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gomez.rhrk.uni-kl.de

Hello Alex,

The problem is exactly the following:

1. I generate a GMF application but I would like to save the models herein
by using a different file format. Not XML.

2. I added the "org.eclipse.emf.ecore.extension_parser" to my EMF project,
and then my custom resource implementation class in there. I have also
specified a file type.

3. I have set up some breakpoints at my custom resource implementation
class, in the procedure doSave().

3. Then I generated the codes, for the diagram and the editors, and launch
it.

4. Afterwards, I have created a model in the editor and then try to save
it. My class is never called, and the files are still saved by using the
XML format.

I do not know if I have to set the extension point in the generated code,
or if I have to create a ResourceImplementationFactory specific for my
model, and then add this class to the extension point (By the way I have
already try this and it does not work as well).

I would appreciate if you have any further hints, because I am kind of
stuck here!!!

Thanks a lot,

Carolina.
Re: GMF Serialization [message #171858 is a reply to message #171817] Fri, 08 February 2008 05:40 Go to previous message
Eclipse UserFriend
Hello Carolina,

> 2. I added the "org.eclipse.emf.ecore.extension_parser" to my EMF
> project, and then my custom resource implementation class in there. I
> have also specified a file type.
How did you register your custom resource implementation in this extension
point? It should be done via custom ResourceFactory implementation (see examples
in org.eclipse.emf.ecore.xmi/plugin.xml)

> 3. I have set up some breakpoints at my custom resource implementation
> class, in the procedure doSave().
Try setting break-point in CustomResrouceImpl constructor or even in corresponding
ResourceFactoty instantiating it.

> I do not know if I have to set the extension point in the generated
> code, or if I have to create a ResourceImplementationFactory specific
Generated code is using standard EMF way to load/save resources, so you should
plug into EMF custom resource implementation and then all the EMF-based applications
will start working with it (including GMF-generated diagram editor).

-----------------
Alex Shatalin
Previous Topic:Cancelling a Dialog opened in a Command
Next Topic:Note Attachment disappears
Goto Forum:
  


Current Time: Sat May 10 18:59:07 EDT 2025

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

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

Back to the top