Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » DND
DND [message #199673] Tue, 18 October 2005 11:59 Go to next message
Eclipse UserFriend
Originally posted by: greg.gigon.tugulu.com

Hello.
I was trying to add DND support to my editor, and I can't do it.
In my navigator viewer I added this line:

this.viewer.addDragSupport(DND.DROP_COPY, new Transfer[]
{ ElementTransfer.getInstance() }, new
ElementDragSourceListener(this.viewer));

It adds support for dragin.
ElementTransfer is a simple class that extends ByteArrayTransfer() and
don't do too much. ElementDragSourceListener is a extension of
DragSourceAdapter class.

It has method dragSetData() that sets event.data to my dragged object.

Now DROP SUPPORT.

In my EDITOR CLASS:

protected void initializeGraphicalViewer()
{
...
_graphicalViewer.addDropTargetListener(new
DiagramDropTargetListener(_graphicalViewer));
...
}

and:

public class DiagramDropTargetListener implements
TransferDropTargetListener{...}
// org.eclipse.jface.util.TransferDropTargetListener;

Method drop(DropTargetEvent event) is the one that should finaly drop
dragged object. Unfortunatelly event.data = null.
When i did simple DEBUG it turns that dragSetData() is called at the
very end, after drop() is called.

Now I'm really confused. Can someone please tell me how to implement
this functionality? I'm trying for too long without any results.

Simple example, some clue, whatever will be nice, I'm desperate :)

Am I going good directions by the way?

Cheers, Greg
Re: DND [message #199998 is a reply to message #199673] Thu, 20 October 2005 10:35 Go to previous message
Eclipse UserFriend
Originally posted by: greg.gigon.tugulu.com

Well, it looks like I'm answering my questions lately :)

Because tree that I'm draggin from and Editor that I'm droping are in another, seperate plugins I
needed to use PluginTransfer as my Transfer mechanism. Just need to remmenber that U need to extend
Your Drop Viewer of PluginDropAdapter and implement IDropActionDelegate.

That's it.
Couses a headache anyway :)

Cheers, Greg

Greg wrote:
> Hello.
> I was trying to add DND support to my editor, and I can't do it.
> In my navigator viewer I added this line:
>
> this.viewer.addDragSupport(DND.DROP_COPY, new Transfer[]
> { ElementTransfer.getInstance() }, new
> ElementDragSourceListener(this.viewer));
>
> It adds support for dragin.
> ElementTransfer is a simple class that extends ByteArrayTransfer() and
> don't do too much. ElementDragSourceListener is a extension of
> DragSourceAdapter class.
>
> It has method dragSetData() that sets event.data to my dragged object.
>
> Now DROP SUPPORT.
>
> In my EDITOR CLASS:
>
> protected void initializeGraphicalViewer()
> {
> ...
> _graphicalViewer.addDropTargetListener(new
> DiagramDropTargetListener(_graphicalViewer));
> ...
> }
>
> and:
>
> public class DiagramDropTargetListener implements
> TransferDropTargetListener{...}
> // org.eclipse.jface.util.TransferDropTargetListener;
>
> Method drop(DropTargetEvent event) is the one that should finaly drop
> dragged object. Unfortunatelly event.data = null.
> When i did simple DEBUG it turns that dragSetData() is called at the
> very end, after drop() is called.
>
> Now I'm really confused. Can someone please tell me how to implement
> this functionality? I'm trying for too long without any results.
>
> Simple example, some clue, whatever will be nice, I'm desperate :)
>
> Am I going good directions by the way?
>
> Cheers, Greg
Previous Topic:sticky tool selected on the palette
Next Topic:Tutorial for GEF
Goto Forum:
  


Current Time: Fri Apr 26 22:12:29 GMT 2024

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

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

Back to the top