Drag and drop inside and outside a viewer [message #216719] |
Tue, 23 May 2006 19:45  |
Eclipse User |
|
|
|
I'm trying to implement a drag and drop transfer in the GEF Shapes Editor
example so that the shapes can be dragged to another application.
As an example, I've added the following code to
ShapesEditor.initializeGraphicalViewer() so that when i drag and drop from
the editor into NotePad, it will paste "hello world":
viewer.addDragSourceListener (new TransferDragSourceListener ()
{
public Transfer getTransfer ()
{
return TextTransfer.getInstance ();
}
public void dragFinished (DragSourceEvent event)
{
}
public void dragSetData (DragSourceEvent event)
{
event.data = "hello world";
}
public void dragStart (DragSourceEvent event)
{
event.doit = true;
});
});
This works fine, and I can now drag and drop from the editor into Notepad
as I intended. However now the drag and drop inside the Editor itself is
no longer working. I can no longer move or resize objects on the canvas,
and it seems the FigureCanvas itself is no longer receiving MouseMove
events while drag and drog is initiated.
How do I implement drag and drop so that while inside the viewer, the
normal selection tool manages the drag and drop and while outside the
viewer, the drop transfer is enabled.
|
|
|
Re: Drag and drop inside and outside a viewer [message #216905 is a reply to message #216719] |
Fri, 26 May 2006 16:04  |
Eclipse User |
|
|
|
Mark Siegel wrote:
> How do I implement drag and drop so that while inside the viewer, the
> normal selection tool manages the drag and drop and while outside the
> viewer, the drop transfer is enabled.
I would love it if someone could answer this question.
I've looked into "re-implementing" the internal drag and drop
functionality by creating a second drop target that uses a different
transfer type. Re-implementing is non-trivial however (IMHO).
Someone else mentioned the idea of using a modifier key to switch
between being able to drag internally vs dragging to external parts.
Search for "GEF as native Drag Source" in the newsgroup to find Eduard
Grasa's response to my earlier question on this issue.
jaaron
|
|
|
Powered by
FUDForum. Page generated in 0.02780 seconds