native drag and drop question [message #436895] |
Tue, 25 May 2004 22:40 |
Eclipse User |
|
|
|
Originally posted by: snipetress.yahoo.com
Hi,
I'm currently trying to drag and drop a file to outside of eclipse, so I'm
trying to implement the native drag and drop. The flow of the drag and drop
is as follows: dragStart, dragSetData, dragFinish.
To get native drag and drop to work, I need to set the data field in the
DragSourceEvent when I'm in the method DragSetData(DragSourceEvent event).
I'm running into a problem when I need to do some pre-processing in
DragSetData before actually setting the data field in the event. This is
what my dragSetData looks like:
public void dragSetData(DragSourceEvent event) {
downloadResource(); //a method that takes a long time to do
event.data = resourceLocation;
}
The problem is that when I drag an item from my view to outside of eclipse,
I have to hold the mouse to wait until the method downloadResource() is
completed first before letting go. If I let go of the mouse before
downloadResource() has completed, the drop doesn't happen(ie. the item is
not dropped to outside of eclipse).
My guess is that Windows thinks that event.data is ready to be used as soon
as I let go of the mouse, while in fact the downloading is still happening
and the event.data has not yet been set.
Here are my questions:
1. Is my guess correct?
2. If my guess is correct, how do I delay event.data to be used?
Thanks!
|
|
|
Powered by
FUDForum. Page generated in 0.03115 seconds