Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Add for existing Model
Add for existing Model [message #1047907] Tue, 23 April 2013 20:39 Go to next message
Christian Pelster is currently offline Christian Pelster
Messages: 23
Registered: January 2010
Junior Member
Hi all,

maybe someone can point me in the right direction with my problem:

Scenario:
I already have a XText based DSL that I want to enhance with a graphiti based editor. I followed the tutorial and implemented the whole "addFeature" thing so that I should be able to create diagrams for my existing model.
When I start my plugin I'm able to create a new diagram (so far so good).

But how do I add the currently existing model elements to my diagram. In the tutorial there is an "EClasses" tree under the example project root where I can add the classes to the diagram via drag and drop. How can I achieve this for my DSL?
My idea is to add the diagram elements from the models outline via drag and drop, but I don't know where to start?

Regards,

Christian
Re: Add for existing Model [message #1047913 is a reply to message #1047907] Tue, 23 April 2013 20:50 Go to previous messageGo to next message
Rob Cernich is currently offline Rob Cernich
Messages: 40
Registered: September 2011
Member
Hey Christian,

I recommend creating update features for each model object that you expect to include in the diagram. Your root/diagram update feature should look for missing elements and add them. Likewise, it should look for shapes that have no related business object and delete those shapes.

Hope that helps.
Rob
Re: Add for existing Model [message #1048158 is a reply to message #1047913] Wed, 24 April 2013 05:43 Go to previous messageGo to next message
Christian Pelster is currently offline Christian Pelster
Messages: 23
Registered: January 2010
Junior Member
Hi,

but how can I add the Objects from the model to the diagram? I only have my textual model representation and need some sort UI to enable the user to add elements from the model to the diagram (like in the example the EClasses tree at http://help.eclipse.org/juno/topic/org.eclipse.graphiti.doc/resources/docu/gfw/visio/project-explorer-editor.png).

Thanks,

Christian
Re: Add for existing Model [message #1048294 is a reply to message #1048158] Wed, 24 April 2013 09:19 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 154
Registered: July 2009
Senior Member
Hi,

the problem might be in the Xtext outline view. You might want to ask in the Xtext group if Drag from outline is supported. Note that the graphiti example uses the project explorer view.

Regards,

Andreas

[Updated on: Wed, 24 April 2013 09:21]

Report message to a moderator

Re: Add for existing Model [message #1048314 is a reply to message #1048294] Wed, 24 April 2013 09:57 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1618
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Christian,

Andreas correctly pointed out one side of this. Additionally, on the Graphiti editor side you might need to install an additional drop target listener to react on the drag & drop operation, depending on what the siurce delivers. Graphiti by default enables the drop from the project explorer but maybe not from th xtext outline. Drop target listeners are added in the init method of DiagramEditor.

Michael
Re: Add for existing Model [message #1049040 is a reply to message #1048314] Thu, 25 April 2013 09:14 Go to previous message
Christian Pelster is currently offline Christian Pelster
Messages: 23
Registered: January 2010
Junior Member
Hi all,

I ended up with implementing a navigator content provider for the project view that displays the model tree. From there drag and drop to graphiti diagrams went out of the box.
Thanks for you help.

Christian
Previous Topic:setBackground(Color color) not immediately affected after a call from an Adapter.notifyChanged()
Next Topic:Image resize and rotate
Goto Forum:
  


Current Time: Sat Oct 25 22:57:48 GMT 2014

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

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