Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Drag and Drop to SWT
Drag and Drop to SWT [message #714751] Thu, 11 August 2011 12:46 Go to next message
David  is currently offline David
Messages: 5
Registered: August 2011
Junior Member
Hi,
I am working on a project that uses both graphiti diagrams and various SWT components. Now I am trying to establish a connection between a SWT text widget and a model element in agraphiti diagram using drag and drop. I know how to implement a drag and drop within SWT components and within a graphiti diagram (as connections), but I am not sure how to make it work from SWT to graphiti (or the other way round). Is it even possible?

Best
David
Re: Drag and Drop to SWT [message #715699 is a reply to message #714751] Mon, 15 August 2011 08:58 Go to previous messageGo to next message
Tim Kaiser is currently offline Tim Kaiser
Messages: 118
Registered: July 2009
Senior Member
Hi David,

an example for dragging from SWT to Graphiti is available in the tutorial:
you can drag an EClass from the project explorer to the Graphiti diagram.
(have a look at the TutorialPasteEClassFeature)

The other way around might be difficult, since if you try to drag a shape
outside of the diagram, the diagram is enlarged and the shape can't leave
the diagrams boundaries.

Can you work around this limitation using copy and paste? The view/editor which
should receive graphiti shapes should implement an appropriate paste handling.

Best, Tim
Re: Drag and Drop to SWT [message #716275 is a reply to message #715699] Tue, 16 August 2011 20:59 Go to previous messageGo to next message
David  is currently offline David
Messages: 5
Registered: August 2011
Junior Member
Hi Tim,

thanks for your answer, it gave me new ideas for my problems! However, I am not sure whether TutorialPasteEClassFeature is the right class to look at as far as drag and drop is concerned. I dragged an EClass into the diagram in debug mode with a breakpoint set in the paste method, but it did not react. The class seemed to only come to life when actually pasting a EClass into a diagram. Maybe I missed something?

I agree that dragging from graphiti to SWT seems to be more difficult, so I will concentrate on the other direction. The purpose of my intended drag and drop action is not to create a diagram component (such as an EClass in the tutorial) but to deliver an object to an existing diagram component and perform further actions. I could definitely implement copy/paste, but this would not bring too much benefit, since the functionality behind it all already works. It is really "just" about the better usability of being able to drag and drop.

Best
David
Re: Drag and Drop to SWT [message #716429 is a reply to message #716275] Wed, 17 August 2011 11:40 Go to previous message
Tim Kaiser is currently offline Tim Kaiser
Messages: 118
Registered: July 2009
Senior Member
Hi David,

you are perfectly right. As explained in the tutorial
the add feature for the respective model object takes care
of reacting to a drag on top of the editor.

Best, Tim
Previous Topic:Nested GA inside FixedPointAnchors?
Next Topic:Where is the location of a FixPointAnchor?
Goto Forum:
  


Current Time: Sat Oct 25 09:49:52 GMT 2014

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

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