Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » DND from view to editor
DND from view to editor [message #532407] Sun, 09 May 2010 17:47 Go to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi,

I am currently working on a GMF editor that supports DND from a view to my editor.

For this I first created a Transfer Object that transfers data from my view.
After this I added a DropTargetListener to my GraphicalViewer on my DiagramEditor to recieve this drop events.
This seems to be working for my transfer and the method "getObjectsBeingDropped" is called.

Now I am stuck. What is that method supposed to return? is it an EObject that can be dropped? Can I access my transfered data within that listener?
Do I need an editPolicy to complete this task or is that listener enough?

Help is greatly appreciated!

Kind regards,
Artur
Re: DND from view to editor [message #534293 is a reply to message #532407] Tue, 18 May 2010 15:17 Go to previous messageGo to next message
Ralf is currently offline RalfFriend
Messages: 25
Registered: March 2010
Junior Member
Well, this seems to be a frequently unsolved question. There are several questions about Drag and Drop between a TreeViewer and a GMF editor but no real tutorial is available. The best example I found so far is this:

http://defrag-sly.javaeye.com/blog/483362

My problem with this code template is the ResourceTransfer, as I want to transfer an EMF object. If I change the ResourceTransfer to a LocalSelectionTransfer the DropObjectEditPolicy is no longer invoked. It seems the LocalSelectionTransfer is already used internally by GMF and can't be used in our situation.

[Updated on: Tue, 18 May 2010 15:17]

Report message to a moderator

Re: DND from view to editor [message #534328 is a reply to message #534293] Tue, 18 May 2010 16:59 Go to previous message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi,

well that code didn't really help me unfortunately.

Funnily I managed to implement DND once for the normal package explorer on the graphical viewer. It seemed that the DropListener already registered with GMF supports ResourceTransfers.

When I created my own listener with my own transfer I had problems accessing my dragged objects (DragSetData is called only when the drop should be executed, however the listener on the graphicalviewer tries to create a command before and I think determines whether or not drop is allows by that command).
When I "hacked' my dragged objects into the listener, so I can access it statically for a test, the EObjects I created and returned in the listener couldn't build a suitable command to be executed, so the drop couldn't be executed.

I think a tutorial would be very nice at this point Smile

Kind regards,
artur
Previous Topic:Rectilinear Routing as Default in GMF 2.1.1 +
Next Topic:pass a parameter in object contribution
Goto Forum:
  


Current Time: Sat Jul 27 04:33:34 GMT 2024

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

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

Back to the top