Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Drag and Drop - dragSetData never gets called
Drag and Drop - dragSetData never gets called [message #451406] Tue, 01 March 2005 10:08 Go to next message
Eclipse UserFriend
Originally posted by: Thomas.Piekarski.nospam.gmx.de

Hi.

I'm trying to drag from a jface Treeviewer to a gef editor.
I'm using the following snippet to add a drag source listener:

----
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new
MyDragSourceListener(viewer));
----

If i start dragging a tree item, the method dragStart of the listener
gets called, but dragSetData is never called.
Am i doing something wrong? Is it a bug?

Greets and thanks

Btw. i am using eclipse 3.1M4
Re: Drag and Drop - dragSetData never gets called [message #451412 is a reply to message #451406] Tue, 01 March 2005 12:16 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
What does MyDragSourceListener look like? What does your drop target look
like?

Take a look at the following articles:

http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml
http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html


"Thomas Piekarski" <Thomas.Piekarski.nospam@gmx.de> wrote in message
news:d01f68$go9$2@www.eclipse.org...
> Hi.
>
> I'm trying to drag from a jface Treeviewer to a gef editor.
> I'm using the following snippet to add a drag source listener:
>
> ----
> int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
> Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
> viewer.addDragSupport(dndOperations, transfers, new
> MyDragSourceListener(viewer));
> ----
>
> If i start dragging a tree item, the method dragStart of the listener gets
> called, but dragSetData is never called.
> Am i doing something wrong? Is it a bug?
>
> Greets and thanks
>
> Btw. i am using eclipse 3.1M4
Re: Drag and Drop - dragSetData never gets called [message #451441 is a reply to message #451412] Wed, 02 March 2005 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Thomas.Piekarski.nospam.gmx.de

Hi.

After reading all drag and drop articles, i found out, that dragSetData
is not called until the transfer of the data is requested on a drop.

So my mistake was on the drop target (handleDrop) but i was looking for
a mistake in the drag source listener.

I got it working now, but i think i will need more help sooner or later ;-)


Veronika Irvine wrote:
> What does MyDragSourceListener look like? What does your drop target look
> like?
>
> Take a look at the following articles:
>
> http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml
> http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html
>
>
> "Thomas Piekarski" <Thomas.Piekarski.nospam@gmx.de> wrote in message
> news:d01f68$go9$2@www.eclipse.org...
>
>>Hi.
>>
>>I'm trying to drag from a jface Treeviewer to a gef editor.
>>I'm using the following snippet to add a drag source listener:
>>
>>----
>>int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
>>Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
>>viewer.addDragSupport(dndOperations, transfers, new
>>MyDragSourceListener(viewer));
>>----
>>
>>If i start dragging a tree item, the method dragStart of the listener gets
>>called, but dragSetData is never called.
>>Am i doing something wrong? Is it a bug?
>>
>>Greets and thanks
>>
>>Btw. i am using eclipse 3.1M4
>
>
>
Re: Drag and Drop - dragSetData never gets called [message #456978 is a reply to message #451441] Mon, 13 June 2005 18:00 Go to previous message
No real name is currently offline No real nameFriend
Messages: 7
Registered: July 2009
Junior Member
Hi,
Can you elaborate on what the source of your problem was? I have the
same problem. I have worked around it by setting my data in the
dragStart() method.
In my situation I have overridden ByteArrayTransfer with a class that
does nothing (all the dragging events are internal to RCP application.)

The ViewerDropAdapter.performDrop method is called correctly, and I
can't find any problem there, but the dragSetData method never gets
called. Something to do with my implementation of ByteArrayTransfer I
suspect, but I have no idea what I did to prevent the sending of the
dragsetdata event.

Thx,
evan


Thomas Piekarski wrote:
> Hi.
>
> After reading all drag and drop articles, i found out, that dragSetData
> is not called until the transfer of the data is requested on a drop.
>
> So my mistake was on the drop target (handleDrop) but i was looking for
> a mistake in the drag source listener.
>
> I got it working now, but i think i will need more help sooner or later ;-)
>
>
> Veronika Irvine wrote:
>
>> What does MyDragSourceListener look like? What does your drop target
>> look like?
>>
>> Take a look at the following articles:
>>
>> http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml
>> http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html
>>
>>
>> "Thomas Piekarski" <Thomas.Piekarski.nospam@gmx.de> wrote in message
>> news:d01f68$go9$2@www.eclipse.org...
>>
>>> Hi.
>>>
>>> I'm trying to drag from a jface Treeviewer to a gef editor.
>>> I'm using the following snippet to add a drag source listener:
>>>
>>> ----
>>> int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
>>> Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
>>> viewer.addDragSupport(dndOperations, transfers, new
>>> MyDragSourceListener(viewer));
>>> ----
>>>
>>> If i start dragging a tree item, the method dragStart of the listener
>>> gets called, but dragSetData is never called.
>>> Am i doing something wrong? Is it a bug?
>>>
>>> Greets and thanks
>>>
>>> Btw. i am using eclipse 3.1M4
>>
>>
>>
>>
Previous Topic:Writing text in a image and save
Next Topic:SWT Event Dispatching in new Runnable() - SWT on Mac OS X 10.4.1
Goto Forum:
  


Current Time: Thu Apr 18 01:30:42 GMT 2024

Powered by FUDForum. Page generated in 0.01944 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top