Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Drag and drop inside and outside a viewer
Drag and drop inside and outside a viewer [message #216719] Tue, 23 May 2006 23:45 Go to next message
Mark Siegel is currently offline Mark SiegelFriend
Messages: 3
Registered: July 2009
Junior Member
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 20:04 Go to previous message
J Aaron Farr is currently offline J Aaron FarrFriend
Messages: 18
Registered: July 2009
Junior Member
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
Previous Topic:using Rulers
Next Topic:connecting draw2d with an rcp app.
Goto Forum:
  


Current Time: Fri Apr 26 14:52:11 GMT 2024

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

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

Back to the top