From c7cbced32992f5cff36e25ce2932835717af3cbb Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Fri, 28 Sep 2012 10:23:02 -0400 Subject: Bug 389702 - Drag and drop a tab item to desktop/Finder, a text file is created, not a web link is generated. --- .../cocoa/org/eclipse/swt/dnd/Clipboard.java | 4 ++-- .../cocoa/org/eclipse/swt/dnd/DragSource.java | 2 +- .../cocoa/org/eclipse/swt/dnd/DropTarget.java | 2 +- .../cocoa/org/eclipse/swt/dnd/URLTransfer.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/Clipboard.java index fe90d62be2..3c311372e5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/Clipboard.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/Clipboard.java @@ -291,7 +291,7 @@ public Object getContents(Transfer transfer, int clipboards) { tdata.data = pasteboard.stringForType(type); } else if (type.isEqual(OS.NSFilenamesPboardType)) { tdata.data = new NSArray(pasteboard.propertyListForType(type).id); - } else if (type.isEqual(OS.NSURLPboardType)) { + } else if (type.isEqual(OS.NSURLPboardType) || type.getString().equals("public.url")) { tdata.data = NSURL.URLFromPasteboard(pasteboard); } else { tdata.data = pasteboard.dataForType(type); @@ -459,7 +459,7 @@ public void setContents(Object[] data, Transfer[] dataTypes, int clipboards) { dataType.isEqual(OS.NSRTFPboardType) || dataType.isEqual(OS.NSHTMLPboardType)) { pasteboard.setString((NSString) tdata, dataType); - } else if (dataType.isEqual(OS.NSURLPboardType)) { + } else if (dataType.isEqual(OS.NSURLPboardType) || dataType.getString().equals("public.url")) { NSURL url = (NSURL) tdata; url.writeToPasteboard(pasteboard); } else if (dataType.isEqual(OS.NSFilenamesPboardType)) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java index 04f7e2efef..70b7149169 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java @@ -751,7 +751,7 @@ void pasteboard_provideDataForType(long /*int*/ id, long /*int*/ sel, long /*int dataType.isEqual(OS.NSHTMLPboardType) || dataType.isEqual(OS.NSRTFPboardType)) { pasteboard.setString((NSString) tdata, dataType); - } else if (dataType.isEqual(OS.NSURLPboardType)) { + } else if (dataType.isEqual(OS.NSURLPboardType) || dataType.getString().equals("public.url")) { NSURL url = (NSURL) tdata; url.writeToPasteboard(pasteboard); } else if (dataType.isEqual(OS.NSFilenamesPboardType)) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java index 6383d896df..79c7a0b691 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java @@ -692,7 +692,7 @@ boolean drop(NSObject sender) { type.isEqual(OS.NSHTMLPboardType) || type.isEqual(OS.NSRTFPboardType)) { tdata.data = pasteboard.stringForType(type); - } else if (type.isEqual(OS.NSURLPboardType)) { + } else if (type.isEqual(OS.NSURLPboardType) || type.getString().equals("public.url")) { tdata.data = NSURL.URLFromPasteboard(pasteboard); } else if (type.isEqual(OS.NSFilenamesPboardType)) { tdata.data = new NSArray(pasteboard.propertyListForType(type).id); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java index c316886fa9..3266309332 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java @@ -30,7 +30,7 @@ import org.eclipse.swt.internal.cocoa.*; public class URLTransfer extends ByteArrayTransfer { static URLTransfer _instance = new URLTransfer(); - static final String URL = OS.NSURLPboardType.getString(); + static final String URL = OS.VERSION >= 0x1060 ? "public.url" /* kUTTypeURL */ : OS.NSURLPboardType.getString(); static final int URL_ID = registerType(URL); private URLTransfer() {} -- cgit