Dnd Problems on a Tree [message #455958] |
Tue, 24 May 2005 04:44  |
Eclipse User |
|
|
|
Originally posted by: ssc.acentic.net
Hi
I have a tree with drag and drop which works fine so far.
I created a object "Book" which I attach to the treeItem with setData.
This also works fine.
The problem appears when I drag and drop a treeitem, I am not able to
transfer the object to the new treeitem. Getting the name is not a
problem, but the object is.
I use this to get the name :
public void drop (DropTargetEvent event) {
if (event.data == null) {
event.detail = DND.DROP_NONE;
return;
}
String text = (String) event.data;
}
which works ok, but how would I get the object. I assumed to do someting
like this :
Book mybook = (Book) event.data;
System.out.println(mybook.gettitle());
But that gave me a CastException.
Book mybook = (Book) event.item;
System.out.println(mybook.gettitle());
This works fine on the other hand, but unfortunately that gives me the
data of the drop target and not the source.
Hope anyone can help me out here.
Thanks,
Sebastian
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.02518 seconds