summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2012-09-28 10:33:42 -0400
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-09-28 10:33:42 -0400
commit71e1311cbbe9e51dc606d59ab142f6565e43ed78 (patch)
tree31f9b4fb8957b22c2607013ea294c936f334098d
parentc7cbced32992f5cff36e25ce2932835717af3cbb (diff)
downloadeclipse.platform.swt-71e1311cbbe9e51dc606d59ab142f6565e43ed78.tar.gz
eclipse.platform.swt-71e1311cbbe9e51dc606d59ab142f6565e43ed78.tar.xz
eclipse.platform.swt-71e1311cbbe9e51dc606d59ab142f6565e43ed78.zip
Bug 389702 - Drag and drop a tab item to desktop/Finder, a text file is created, not a web link is generated. - use OS const for public.url
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/Clipboard.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/URLTransfer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java4
8 files changed, 23 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 3c311372e5..41617fb9d7 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) || type.getString().equals("public.url")) {
+ } else if (type.isEqual(OS.NSURLPboardType) || type.isEqual(OS.kUTTypeURL)) {
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) || dataType.getString().equals("public.url")) {
+ } else if (dataType.isEqual(OS.NSURLPboardType) || dataType.isEqual(OS.kUTTypeURL)) {
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 70b7149169..7913169496 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) || dataType.getString().equals("public.url")) {
+ } else if (dataType.isEqual(OS.NSURLPboardType) || dataType.isEqual(OS.kUTTypeURL)) {
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 79c7a0b691..ad379cb18d 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) || type.getString().equals("public.url")) {
+ } else if (type.isEqual(OS.NSURLPboardType) || type.isEqual(OS.kUTTypeURL)) {
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 3266309332..482addd71e 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.VERSION >= 0x1060 ? "public.url" /* kUTTypeURL */ : OS.NSURLPboardType.getString();
+ static final String URL = (OS.VERSION >= 0x1060 ? OS.kUTTypeURL : OS.NSURLPboardType).getString();
static final int URL_ID = registerType(URL);
private URLTransfer() {}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index be188f37e4..4265e29710 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -6276,6 +6276,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(kCTParagraphStyleAttributeName)
}
#endif
+#ifndef NO_kUTTypeURL
+JNIEXPORT jintLong JNICALL OS_NATIVE(kUTTypeURL)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, kUTTypeURL_FUNC);
+ rc = (jintLong)kUTTypeURL;
+ OS_NATIVE_EXIT(env, that, kUTTypeURL_FUNC);
+ return rc;
+}
+#endif
+
#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_cocoa_CFRange_2J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index 50bba2969c..bc7ced2440 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -465,6 +465,7 @@ char * OS_nativeFunctionNames[] = {
"kCTForegroundColorAttributeName",
"kCTParagraphStyleAttributeName",
"kTISPropertyUnicodeKeyLayoutData",
+ "kUTTypeURL",
#ifndef JNI64
"memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I",
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index fa14656ec9..908ae58737 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -475,6 +475,7 @@ typedef enum {
kCTForegroundColorAttributeName_FUNC,
kCTParagraphStyleAttributeName_FUNC,
kTISPropertyUnicodeKeyLayoutData_FUNC,
+ kUTTypeURL_FUNC,
#ifndef JNI64
memmove__ILorg_eclipse_swt_internal_cocoa_CFRange_2I_FUNC,
#else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index 59bfbd3c75..426a229703 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -535,6 +535,10 @@ public static final native long /*int*/ kCFTypeDictionaryKeyCallBacks();
/** @method flags=const address*/
public static final native long /*int*/ kCFTypeDictionaryValueCallBacks();
+/** @method flags=const */
+public static final native long /*int*/ kUTTypeURL();
+public static final NSString kUTTypeURL = new NSString(kUTTypeURL());
+
/** Objective-C runtime */
/**