Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create Diagram from xml source
Create Diagram from xml source [message #484860] Wed, 09 September 2009 14:18 Go to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi.

My application should be able to create a gmf diagram from an xml
resource. I am able to create the neccessary xml resource programmatically
from my source file.

How can I create the diagram now using this xml source? So far I was just
copy/pasting the xml code into my diagram file.
The problem with that is, that when I don't modify and change it, the next
time I open this diagram file, it appears to be empty..

Is there a method I can pass an xml source for the neccessary diagram
information?

Any help will be very nice :) Thanks.

Artur
Re: Create Diagram from xml source [message #484909 is a reply to message #484860] Wed, 09 September 2009 16:28 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Artur,

Try Init ??? diagram file action from the popup menu of your model file.

-----------------
Alex Shatalin
Re: Create Diagram from xml source [message #484951 is a reply to message #484909] Wed, 09 September 2009 20:53 Go to previous messageGo to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi Alex,

thank you for your relpy.

I looked into that action and I can actually do that. But I wanted to do
it programmatically. So I would create my model file in the memory and
give the root of that xml object as an EObject into the method of the init
file. I think this would work.

What I did now is just writing the whole template file myself (My model
and diagram information are in the same file). I just dump that file into
the workspace and I can open it. Everything is fine.

I had a problem with the connections and empty diagrams because the
diagram information wasn't saved right aways. However, if I remove the
semantic hints from the node and the edge from the plugin XML everything
seems to be working.

Is that a way I should do that, or would it cause problems later on if I
don't create my diagrams with the init action of gmf? It seems to me that
the init actions is creating the same file I do manually?

Best regards,
Artur
Re: Create Diagram from xml source [message #485058 is a reply to message #484951] Thu, 10 September 2009 12:01 Go to previous message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Artur,

I think it make sence to use code (like in init action) to create your diagram
file programatically.
If you simply generate code from the model then it looks error-prone for
me, but you can use this technique if it works for you.

-----------------
Alex Shatalin
Previous Topic:Reacting to changes in other resources in the same TransactionalEditingDomain
Next Topic:Show referenced Node name on Label
Goto Forum:
  


Current Time: Wed Apr 24 23:57:45 GMT 2024

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

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

Back to the top