Detect drop location from DND event [message #716387] |
Wed, 17 August 2011 05:19  |
Eclipse User |
|
|
|
Hello,
perhaps I am just blind, but after searching the API and in the forum, I still have no clue, how I can detect where an object was dropped to from an SWT widget like a TreeViewer.
I have the following code:
// Enable Drag & Drop Support
int ops = DND.DROP_COPY;
Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
treeViewer.addDragSupport(ops, transfers, myListener);
Where SourceDragListener is an own implementation of DragSourceListener. What I want to achieve is, that if someone drags something from the treeViewer object to the Java editor of Eclipse (and only then) some actions are invoked (like formatting the code). Therefore, I need to find out if the item was dropped to the Java Editor of the current Eclipse instance (and not to any arbitrary text editor or other widget that accepts a TextTransfer.
Is there a possibility to achieve that? In the "event" object in the DragSourceListener I can't find such an information unfortunately.
Thanks.
|
|
|
|
|
|
|
|
Re: Solution [message #721571 is a reply to message #721562] |
Fri, 02 September 2011 02:46  |
Eclipse User |
|
|
|
Hi!
It did not work out in my case. Since I want to transfer BodyDeclarations I had to write my own Transfer type anyhow and add it to the CompilationUnitEditor; thus the solution I found works well for me now.
Cheers!
|
|
|
Powered by
FUDForum. Page generated in 0.06146 seconds