Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 30104 - Drag & Drop not implemented on the Mac
Summary: Drag & Drop not implemented on the Mac
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal with 8 votes (vote)
Target Milestone: ---   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 23960 35071 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-01-23 12:02 EST by Steve Northover CLA
Modified: 2004-06-22 15:06 EDT (History)
12 users (show)

See Also:


Attachments
Test case for Drag to Finder (1.57 KB, text/plain)
2004-03-29 15:09 EST, Eric Zimmerman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Northover CLA 2003-01-23 12:02:23 EST
We should try to do this for 2.2.
Comment 1 Steve Northover CLA 2003-01-23 12:03:37 EST
*** Bug 23960 has been marked as a duplicate of this bug. ***
Comment 2 Alex Blewitt CLA 2003-01-23 12:50:20 EST
I do not understand why you created a new bug for this, and closed the older one as a duplicate. The older one had a number of people -- including myself -- on the CC list for this bug.

Later bugs are normally closed as the duplicate, and not the earlier ones.
Comment 3 Steve Northover CLA 2003-01-23 13:16:14 EST
I made a mistake.
Comment 4 Nick Edgar CLA 2003-03-31 11:43:59 EST
*** Bug 35071 has been marked as a duplicate of this bug. ***
Comment 5 Steve Northover CLA 2003-06-13 10:18:20 EDT
NOTE:  Drag & Drop is unrelated to the ability to drag views around in 
Eclipse.  This has been implemented for 2.1.1 and 3.0.

Drag & Drop refers to classes in the package org.eclipse.swt.dnd and deals 
with dragging and dropping data between SWT and native apps, being a drop 
target or drag source none of which Eclipse is doing when you drag around a 
view in the IDE.
Comment 6 Veronika Irvine CLA 2003-06-13 11:09:23 EDT
Dragging Views around in eclipse is addressed by bug 28525 which has been 
fixed in 2.1.1 and 3.0.
Comment 7 rv CLA 2003-09-28 11:49:21 EDT
I would like to mention that it would already be very helpful if the DropTarget just generated the 
events (as the DragSource does).
Comment 8 Steve Northover CLA 2003-09-29 11:29:25 EDT
Veronika, didn't you implement this?  If so, please close this PR.
Comment 9 Veronika Irvine CLA 2003-09-30 09:36:58 EDT
The DropTarget already generates events.  They are not the same events as the 
DragSource - they are the events relevant to a dorp target.

See:
http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html

Most of DND has been implemented on the Mac (and ported back to 2.1.1).

The things that are still missing are:
- enable DND between applications, currently disabled until interaction with 
Finder can be made safe
- enable drag under effects for Table and Tree
Comment 10 Eric Zimmerman CLA 2004-03-17 15:36:44 EST
It has been 6 months since the last update of this request.  Are we still 
waiting on "interaction with Finder can be made safe"?

I would really like to have the ability to drop to finder if at all possible.
Comment 11 Steve Northover CLA 2004-03-17 16:31:17 EST
Eric, feel free to pitch in, browse the code and submit a patch.
Comment 12 Eric Zimmerman CLA 2004-03-18 19:11:19 EST
Ok...I enabled drag capabilities in the swt library and everything seems to 
work great.  What interaction with the finder needs to be made safe?
Comment 13 Steve Northover CLA 2004-03-19 13:54:31 EST
Andre, Veronika is gone right now.  Do you know of the interaction that he's 
talking about?
Comment 14 Steve Northover CLA 2004-03-19 13:55:09 EST
I mean "she's" of course ...
Comment 15 Eric Zimmerman CLA 2004-03-29 14:08:30 EST
A note on drag behavior to the finder...

on Panther 10.3.3 it seems that the Operating System needs to have TextTransfer 
supported for ANY drag to the finder.  You just have to support the type and 
return a valid string when requested. (If you are transferring files it still 
needs this)

on 10.2.8 this is not required and actually always chooses text transfer if you 
support it.  This is a problem since you might be wanting to actually transfer 
another type, like a file.

I special cased 10.3 and above to include the text transfer and every other OS 
and Mac version just include the Transfer type I want to transfer (files in my 
case). Not sure this will work in all cases but at least it provides some 
functionality for my users.

So, I hope this helps someone.  Not sure if this is an Operating System bug or 
not but what a pain!
Comment 16 Steve Northover CLA 2004-03-29 14:14:02 EST
Andre?
Comment 17 Andre Weinand CLA 2004-03-29 14:35:00 EST
I haven't looked into Drag&Drop to Finder under Panther yet.
So, I do not have any more information about this.
But I'll do a quick check...
Comment 18 Andre Weinand CLA 2004-03-29 14:38:40 EST
Eric, do you have any code (or patch) that I can try?
Comment 19 Eric Zimmerman CLA 2004-03-29 15:09:51 EST
Created attachment 8993 [details]
Test case for Drag to Finder

This simple text case shows the variance in behavior between OS X 10.3.3 and
10.2.8.  You need to modify the sample code to point to some local file for
dragging.

You will also need to enable the drag feature in the SWT library.  
Source File: org.eclipse.swt.dnd.DragSource.java 
Method signature: private void drag(Event);
Comment 20 Andre Weinand CLA 2004-03-29 18:01:55 EST
Eric, thanks for the snippet.
I enabled external drags in SWT and used it both with your snippet and with Eclipse.
Here is my conclusion:
- dragging items from Eclipse to other applications (with the exception of the Finder) seems
   to work well on Panther (our only supported Platform for 3.0).
- as already found by Eric, dragging items to the Finder works only if the DragSource
   contains a TextTransfer (in addition to a FileTransfer).
- I don't know what problems comment #9 is referring to ("disabled until interaction
   with Finder can be made safe"), however I couldn't find any problems.

From these findings I suggest to start enabling the drag feature in the SWT library.
The added functionality is useful and I see no risk involved even if interaction with the Finder does not 
work.

But I'm not so sure in how to deal with the additional TextTransfer required for FileTransfer drags to
the Finder. I don't think that application should know about this MacOS implementation detail.
A consequence would be that a FileTransfer includes TextTransfer too. But I don't know whether this is
possible or desirable. 
Comment 21 Steve Northover CLA 2004-03-30 09:44:47 EST
Let's enable it then.  Veronika can check our work when she gets back.
Comment 22 Benjamin Pasero CLA 2004-05-24 08:36:51 EDT
What's the state of DND support in Mac for SWT >= 3.0.52? Is it already 
possible to drag and drop items inside a SWT application from Tree to Tree and 
CTabItem to Tree?

Regards,
ben
Comment 23 Veronika Irvine CLA 2004-06-22 15:06:02 EDT
Closing this bug as fixed in 3.0.

There are two outstanding issues which are tracked in bug 68212 and bug 68213.