DND problem [message #170678] |
Mon, 15 December 2003 17:37  |
Eclipse User |
|
|
|
Originally posted by: arteksmartek.go2.pl
I spent 4 hours and finally I given up :(
here is the problem:
I have TableViewer and TreeViewer, and I defined DND operations as follows:
---------
private class DragAdapter extends DragSourceAdapter {
public void dragSetData(DragSourceEvent event) {
event.data = tableViewer.getSelection();
System.out.println("dragData: " + event.data);
}
Transfer[] transfers = new Transfer[] {
LocalSelectionTransfer.getInstance() };
tableViewer.addDragSupport(DND.DROP_MOVE, transfers, new DragAdapter());
---------
private class DropAdapter extends DropTargetAdapter {
public void drop(DropTargetEvent event){
System.out.println("dropData: " + event.data);
}
}
Transfer[] transfers = new Transfer[] {
LocalSelectionTransfer.getInstance() };
treeViewer.addDropSupport(DND.DROP_MOVE, transfers, new DropAdapter());
---------
after performing DND operation the result is:
dragData: [xxx, yyy, etc...]
dropData: null
why the data in event object is null ?
what did I miss ?
please help
thanks in advance
Artur
|
|
|
|
Re: DND problem [message #171228 is a reply to message #170678] |
Tue, 16 December 2003 14:59  |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
Local selection transfer is only for use within a single viewer. See
also the following article:
http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html
--
Artek wrote:
> I spent 4 hours and finally I given up :(
> here is the problem:
>
> I have TableViewer and TreeViewer, and I defined DND operations as follows:
> ---------
> private class DragAdapter extends DragSourceAdapter {
> public void dragSetData(DragSourceEvent event) {
> event.data = tableViewer.getSelection();
> System.out.println("dragData: " + event.data);
> }
>
> Transfer[] transfers = new Transfer[] {
> LocalSelectionTransfer.getInstance() };
> tableViewer.addDragSupport(DND.DROP_MOVE, transfers, new DragAdapter());
> ---------
> private class DropAdapter extends DropTargetAdapter {
> public void drop(DropTargetEvent event){
> System.out.println("dropData: " + event.data);
> }
> }
> Transfer[] transfers = new Transfer[] {
> LocalSelectionTransfer.getInstance() };
> treeViewer.addDropSupport(DND.DROP_MOVE, transfers, new DropAdapter());
> ---------
>
> after performing DND operation the result is:
> dragData: [xxx, yyy, etc...]
> dropData: null
>
> why the data in event object is null ?
> what did I miss ?
> please help
>
> thanks in advance
>
> Artur
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04056 seconds