Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Cross Viewer Drag & Drop (Does GEF support cross viewer drag and drop? Out of the box?)
Cross Viewer Drag & Drop [message #1806957] Sun, 19 May 2019 17:55 Go to next message
Gerhard Kreuzer is currently offline Gerhard KreuzerFriend
Messages: 6
Registered: May 2019
Junior Member
Hi there,

I'm working on an E4 RCP application (still based on Oxygen), that uses GEF Zest Viewers to display and edit Graphs (similar to signal flow charts). All Graphs of a project form a hierarchy, but are not hosted by a single viewer. (In case it helps, a bit context information: the viewers themselves are hosted by E4 (editor) parts. The application is a SWT / Java FX hybrid, where all but the GEF Zest Viewers is SWT based.)
Given this configuration, the question whether GEF supports cross viewer drag & drop arises... The desired semantics of the D&D is like Copy&Paste or Cut&Paste respectively.
Does GEF support this out of the box? Has anyone done this already?

Thanks in advance!

Gerhard
Re: Cross Viewer Drag & Drop [message #1808672 is a reply to message #1806957] Fri, 28 June 2019 13:01 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Gerhard,

thanks to Kyle Girard, drag and drop is actually supported out of the box since 5.1.0. You can quickly test it out by adapting the MVC Logo Example as follows:

1) Bind DragDropGesture as IDomain adapter: The MvcLogoExampleModule class defines a method bindIDomainAdapters() which can be changed as follows:

	@Override
	protected void bindIDomainAdapters(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
		super.bindIDomainAdapters(adapterMapBinder);
		bindPaletteViewerAsDomainAdapter(adapterMapBinder);
		adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(DragDropGesture.class);
	}


2) Set breakpoint in DragDropGesture where a DragEvent is handled.
3) Drag something into the example application and observe the DragEvent when the breakpoint is hit.

Note that there might be some problems w.r.t. getting the data out of the DragEvent etc.. However, this should be a good starting point. If needed, you can always register a SWT event filter to accommodate for shortcomings w.r.t. JavaFX drag and drop. You might be able to incorporate such extensions in a subclassed DragDropGestureEx.

Best regards,
Matthias
Re: Cross Viewer Drag & Drop [message #1853175 is a reply to message #1808672] Tue, 21 June 2022 19:45 Go to previous message
Gerhard Kreuzer is currently offline Gerhard KreuzerFriend
Messages: 6
Registered: May 2019
Junior Member
Hi Matthias,

I'm late, but I think it's never too late to say THANX!

Your answer put me on the right path, but there is a little subtlety that bothers me. Before I start, a small premise: due to internal restrictions (related to Java 8) we are currently bound to Eclipse 4.16 and GEF 5.3.0 and I have not checked, if my concern has vanished in the current version.

What does bother me, is the fact, that my drag/drop handler does not receive DRAG_ENTERED or DRAG_EXITED calls. I think this is due to bug in the DragDropGesture class, There, the event filters for the cited events are hooked with the scene, but the calls to the policies require, that the event target is an FX node. According to my observation, the ENTERED and EXITED events are delivered to the scene but not to nodes. Therefore I think, that not the ENTERED / EXITED events should be monitored in DragDropGesture, but DRAG_ENTERED_TARGET and DRAG_EXITED_TARGET.

Do you agree? Is this problem still existing in the current version and should I file a bug?

Regards Gerhard
Previous Topic:how to save and import the png within GEF?
Next Topic:I have a question about the GEF.
Goto Forum:
  


Current Time: Sat Apr 20 01:05:35 GMT 2024

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

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

Back to the top