Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to drag-and-drop from Eclipse to GEF editor?
How to drag-and-drop from Eclipse to GEF editor? [message #1793512] Thu, 09 August 2018 11:42 Go to next message
Sebastian Herold is currently offline Sebastian HeroldFriend
Messages: 1
Registered: August 2018
Junior Member
Hi folks,

I am currently developing an editor with GEF5 as plugin for Eclipse. I want users to be able to drag resources from the project explorer onto certain elements in the editor resulting in some changes in the underlying domain model.

I wonder what would be the best way to go? I've naively tried to register an IOnDragHandler but it doesn't react to end-of-drag events if the dragging started outside of the editor (as, for example, in the project explorer). My other thought was to define an SWT DropTarget, however, I don't see which (SWT) control to attach it to in my editor (which is an extension of AbstractFXEditor).

Is there any way to do this?

Cheers
Sebastian
Re: How to drag-and-drop from Eclipse to GEF editor? [message #1793654 is a reply to message #1793512] Mon, 13 August 2018 10:32 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Sebastian,

GEF does not provide drag and drop functionality by default. So the way to go would be a custom implementation for SWT Drag and Drop. The SWT Control for the GEF viewer is the FXCanvas that is constructed by AbstractFXEditor. You can access the FXCanvas using the getCanvas() accessor, which, unfortunately, is protected, so a subclass is needed in order to expose that FXCanvas.

Adding/Manipulating content in response to SWT Drag and Drop can be done via default policies and operations, though, e.g. ContentPolicy: https://github.com/eclipse/gef/blob/master/org.eclipse.gef.mvc.fx/src/org/eclipse/gef/mvc/fx/policies/ContentPolicy.java

edit: The IOnDragHandler interface is used for handling mouse press drag release inside JavaFX.

Best regards,
Matthias

[Updated on: Mon, 13 August 2018 10:47]

Report message to a moderator

Previous Topic:JavaFX Line vs GEF Geometry Line
Next Topic:[GEF4] Multiple selection performance problem
Goto Forum:
  


Current Time: Tue Apr 23 13:50:47 GMT 2024

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

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

Back to the top