DND [message #199673] |
Tue, 18 October 2005 07:59  |
Eclipse User |
|
|
|
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 06:35  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04426 seconds