Skip to main content



      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 07:42 Go to next message
Eclipse UserFriend
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 06:32 Go to previous message
Eclipse UserFriend
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 06:47] by Moderator

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


Current Time: Thu Apr 17 21:28:08 EDT 2025

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

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

Back to the top