Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » binding a diagram file to an external data file
binding a diagram file to an external data file [message #372561] Wed, 29 July 2009 09:49 Go to next message
Eclipse UserFriend
Originally posted by: dganrc77.gmail.com

Hi,

I am developing a diagram editor using GMF.
The aim is to provide a graphical user interface to edit an xml-based file
(let's call it data-file), that normally is edited by a form-based editor.

What I need, so, is to bind the diagram file to the external oiginal file
in a way that each modification of the diagram is reproduced in the
original file and synchronized when necessary.

I listed some basic scenarios for that:
* When create a new diagram
** Select/create a new data-file from the given project
** Bind the newly created diagram to that data-file (the diagram file must
know which is the related external model)
* Synchronization
** Every time the user saves the diagram, save the modification to the
external data-file
* Open a diagram
** (Re)-build diagram from the data-file before opening it

One problem is that I cannot use directly that model as starting model for
the diagram. I must create a new one and then face the synchronization
issues...

So the question is:
- where and how I can interact with the events that holds the
modifications of the diagram?
- where and how I can retrieve the diagram data as model object to provide
conversion to the external model?
- where and how I can craete a diagram file starting form a model I create
externally from the diagram plugin?


Can anyone point me to some resource or has anyone already faced a similar
issue?

(Apologies for the too general scenario, but I am starting now the work
and I need to collect any suggestion from more experienced people then me
before doing weird things...)

Thank you

Enrico
Re: binding a diagram file to an external data file [message #421637 is a reply to message #372561] Thu, 30 July 2009 12:12 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello enrico,

> The aim is to provide a graphical user interface to edit an xml-based
> file
You can:
- create an XSD document describing this xml file structure
- load this document into EMF and generate model code from it
- create GMF diagram working with this model

as a result all the data from the diagram will be stored in accordace with
this XSD (in an original XML format), thanks to EMF!

-----------------
Alex Shatalin
Re: binding a diagram file to an external data file [message #422546 is a reply to message #421637] Thu, 30 July 2009 12:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dganrc77.gmail.com

Hello Alex,
thank you for your reply.

My prroblem is that the data file I need to support has not a 'stable' xml
definition. It is in an RDF based syntax. It is very difficult to define
it with a stable XSD (maybe it is not possible...). So I decided to create
an intermediate model with EMF and using it for the diagram. I did it and
now I am building the diagram editor indipendently from the external data
format (and this is wonderful, thanks gmf!).
Next step would be to translate it in the RDF-based syntax any time it is
needed and save it in that data file to have them synchronized.
Wht I am missing, so, Is where and how change/add code in GMF to provide
this synchronization.

Hope this clarifies my problem

Thank you
Enrico


Alex Shatalin wrote:

> Hello enrico,

>> The aim is to provide a graphical user interface to edit an xml-based
>> file
> You can:
> - create an XSD document describing this xml file structure
> - load this document into EMF and generate model code from it
> - create GMF diagram working with this model

> as a result all the data from the diagram will be stored in accordace with
> this XSD (in an original XML format), thanks to EMF!

> -----------------
> Alex Shatalin
Re: binding a diagram file to an external data file [message #422550 is a reply to message #422546] Thu, 30 July 2009 12:35 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello enrico,

I suggest you listening for Eclipse resource changes - you'll be able to
synchronze both files on editor saving.

-----------------
Alex Shatalin
Re: binding a diagram file to an external data file [message #425317 is a reply to message #421637] Thu, 30 July 2009 13:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dganrc77.gmail.com

Hello Alex,

thank you for your reply.

(I have posted already a reply half an hour ago but sice I don't see it in
the thread I do it again...)

My problem is that the data file is not a classical XML file but and RDF
based one. This means that is very difficult to represent its content in a
n XML schema. That's why I decided to implement a new model for the
diagram and then face the synchronization issues.
So I have created my new EMF model and all is going ok with the definition
of the diagram. Thank you EMF, GEF, GMF (and all acronyms involved ;) )!

My point now is that I need to synchronize the data in the two files.

Where and how I have to add/change code in the diagram package to do that?

How to catch events like 'save', 'open'?

How to retrieve the model from the diagram when saving to convert and
serialize it in the external format?

How to give the model data built from the external file on craetion of a
ne diagram?

Hope this clarifies my issues...

Thank you

Enrico

Alex Shatalin wrote:

> Hello enrico,

>> The aim is to provide a graphical user interface to edit an xml-based
>> file
> You can:
> - create an XSD document describing this xml file structure
> - load this document into EMF and generate model code from it
> - create GMF diagram working with this model

> as a result all the data from the diagram will be stored in accordace with
> this XSD (in an original XML format), thanks to EMF!

> -----------------
> Alex Shatalin
Re: binding a diagram file to an external data file [message #432487 is a reply to message #422550] Thu, 30 July 2009 16:50 Go to previous message
Eclipse UserFriend
Originally posted by: dganrc77.gmail.com

Hello Alex,

> I suggest you listening for Eclipse resource changes - you'll be able to
> synchronze both files on editor saving.

Yes, I will follow that way!
Thank you very much

Enrico
Previous Topic:Prevent illegal drag&drop
Next Topic:Refreshing in Common Navigator
Goto Forum:
  


Current Time: Fri Apr 26 16:26:00 GMT 2024

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

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

Back to the top