Skip to main content



      Home
Home » Eclipse Projects » GEF » TransferDropTargetListener
TransferDropTargetListener [message #16001] Mon, 29 July 2002 06:17 Go to next message
Eclipse UserFriend
Hi,

I'm trying to add two TransferDropTargetListeners to an
AbstractEditPartViewer (like in the logic example).
If I execute this code:

getGraphicalViewer().addDropTargetListener(new
OccurrenceTransferDropTargetListener(getGraphicalViewer(),
FileTransfer.getInstance()));
getGraphicalViewer().addDropTargetListener(new
TextTransferDropTargetListener(getGraphicalViewer(),
TextTransfer.getInstance()));

only the FileTransfer will work. Swaping the two adds only
the TextTransfer will work.

In the AbstractEditPartViewer Code only the first add triggers an
refreshDropTargetAdapter():

public void addDropTargetListener(TransferDropTargetListener listener)
{
if (getDelegatingDropAdapter().isEmpty()) {
// The DropTarget needs to be created and initialized
getDelegatingDropAdapter().addDropTargetListener(listener);
refreshDropTargetAdapter();
}
else {
// The DropTarget should already be set up.
getDelegatingDropAdapter().addDropTargetListener(listener);
}
}

Without the call to refreshDropTargetAdapter() the DropTarget will only
work for the type of Transfer in the first add.

Is there an bug in GEF XOR in my Code to fix?

thanks
Juergen
Re: TransferDropTargetListener [message #16020 is a reply to message #16001] Mon, 29 July 2002 11:51 Go to previous message
Eclipse UserFriend
This is a GEF bug. The if...else... in addDropTargetListener() should be
replaced by the code inside the if part, so that refreshDropTargetAdapter() is
always called.

Eric


"Juergen King" <j.king@alturatec.de> wrote in message
news:3D45164E.8020403@alturatec.de...
> Hi,
>
> I'm trying to add two TransferDropTargetListeners to an
> AbstractEditPartViewer (like in the logic example).
> If I execute this code:
>
> getGraphicalViewer().addDropTargetListener(new
> OccurrenceTransferDropTargetListener(getGraphicalViewer(),
> FileTransfer.getInstance()));
> getGraphicalViewer().addDropTargetListener(new
> TextTransferDropTargetListener(getGraphicalViewer(),
> TextTransfer.getInstance()));
>
> only the FileTransfer will work. Swaping the two adds only
> the TextTransfer will work.
>
> In the AbstractEditPartViewer Code only the first add triggers an
> refreshDropTargetAdapter():
>
> public void addDropTargetListener(TransferDropTargetListener listener)
> {
> if (getDelegatingDropAdapter().isEmpty()) {
> // The DropTarget needs to be created and initialized
> getDelegatingDropAdapter().addDropTargetListener(listener);
> refreshDropTargetAdapter();
> }
> else {
> // The DropTarget should already be set up.
> getDelegatingDropAdapter().addDropTargetListener(listener);
> }
> }
>
> Without the call to refreshDropTargetAdapter() the DropTarget will only
> work for the type of Transfer in the first add.
>
> Is there an bug in GEF XOR in my Code to fix?
>
> thanks
> Juergen
>
Previous Topic:Problem with connection
Next Topic:where can i get a pluggin to have the JAVA SUN API ......
Goto Forum:
  


Current Time: Wed May 28 15:44:52 EDT 2025

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

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

Back to the top