Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2015-10-23 04:13:25 -0400
committerLakshmi Shanmugam2017-08-11 07:44:04 -0400
commita99439d30a7b8da847601ddd9043ac241ce028e9 (patch)
treebe5e70e99f9afc317dd7558d51ddcce1c584a76d /bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa
parentd81458a98525bf0b98909d362bde0ba3e3199d56 (diff)
downloadeclipse.platform.swt-a99439d30a7b8da847601ddd9043ac241ce028e9.tar.gz
eclipse.platform.swt-a99439d30a7b8da847601ddd9043ac241ce028e9.tar.xz
eclipse.platform.swt-a99439d30a7b8da847601ddd9043ac241ce028e9.zip
Bug 467205 - [10.10] FileDialog/DirectoryDialog with SWT.SHEET misplacedI20170811-2000
after slide-down animation Replaced deprecated NSSavePanel and NSOpenPanel APIs with newer ones. The new API NSSavePanel.beginSheetModalForWindow that is required to show the Sheet, uses objective-c block for completion handler. This call can't be made directly from Java, as Java doesn't support the block syntax (^). Hence, it is called from a wrapper function inside C code in os_custom.c. The wrapper function calls beginSheetModalForWindow with the objective C block syntax. The completion handler block is also implemented in os_custom.c which callsback to the Java functionFileDialog/DirectoryDialog._completionHandler(). Change-Id: Ib03881a68ef7ecaf2132cf91a4137aef8b6fe3fc
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSApplication.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java19
4 files changed, 42 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 9d196bf08e..107326b8c9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -181,6 +181,9 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</method>
+ <method selector="stopModal" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="terminate:" swt_gen="true">
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
@@ -2799,10 +2802,18 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</method>
+ <method selector="setDirectoryURL:" swt_gen="true">
+ <arg swt_gen="true"></arg>
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="setMessage:" swt_gen="true">
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</method>
+ <method selector="setNameFieldStringValue:" swt_gen="true">
+ <arg swt_gen="true"></arg>
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="setTitle:" swt_gen="true">
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSApplication.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSApplication.java
index bcfc7e752e..6bd75b3d67 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSApplication.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSApplication.java
@@ -161,6 +161,10 @@ public void stop(id sender) {
OS.objc_msgSend(this.id, OS.sel_stop_, sender != null ? sender.id : 0);
}
+public void stopModal() {
+ OS.objc_msgSend(this.id, OS.sel_stopModal);
+}
+
public void terminate(id sender) {
OS.objc_msgSend(this.id, OS.sel_terminate_, sender != null ? sender.id : 0);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java
index 8b6b3d5213..c590a29d5c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java
@@ -62,10 +62,18 @@ public void setDirectory(NSString path) {
OS.objc_msgSend(this.id, OS.sel_setDirectory_, path != null ? path.id : 0);
}
+public void setDirectoryURL(NSURL directoryURL) {
+ OS.objc_msgSend(this.id, OS.sel_setDirectoryURL_, directoryURL != null ? directoryURL.id : 0);
+}
+
public void setMessage(NSString message) {
OS.objc_msgSend(this.id, OS.sel_setMessage_, message != null ? message.id : 0);
}
+public void setNameFieldStringValue(NSString nameFieldStringValue) {
+ OS.objc_msgSend(this.id, OS.sel_setNameFieldStringValue_, nameFieldStringValue != null ? nameFieldStringValue.id : 0);
+}
+
public void setTitle(NSString title) {
OS.objc_msgSend(this.id, OS.sel_setTitle_, title != null ? title.id : 0);
}
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 1642111f6a..9e6ce3da39 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
@@ -130,6 +130,8 @@ public class OS extends C {
public static final long /*int*/ sel_setQuota = sel_registerName( "setQuota:" );
public static final long /*int*/ sel_webView_frame_exceededDatabaseQuotaForSecurityOrigin_database_ = sel_registerName( "webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:" );
+ public static final long /*int*/ sel_beginSheetModalForWindow_completionHandler_ = sel_registerName("beginSheetModalForWindow:completionHandler:");
+
/* These are not generated in order to avoid creating static methods on all classes */
public static final long /*int*/ sel_isSelectorExcludedFromWebScript_ = sel_registerName("isSelectorExcludedFromWebScript:");
public static final long /*int*/ sel_webScriptNameForSelector_ = sel_registerName("webScriptNameForSelector:");
@@ -184,6 +186,19 @@ public class OS extends C {
public static final long /*int*/ class_NSToolbarView = objc_getClass("NSToolbarView");
+ /*
+ * Wrapper function which will call NSSavePanel.beginSheetModalForWindow. This
+ * implementation allows passing of objective-C block from Java to C code, and
+ * receives a callback from the block to a Java function. Here, handler is a
+ * the function pointer of the function that will be called by the objective-C
+ * block.
+ */
+ /** @method flags=no_gen*/
+ public static native void beginSheetModalForWindow(long id, long sel, long window, long handler);
+ public static void beginSheetModalForWindow(NSPanel id, NSWindow window, long handler) {
+ OS.beginSheetModalForWindow(id.id, OS.sel_beginSheetModalForWindow_completionHandler_, window != null ? window.id : 0, handler);
+ }
+
/** JNI natives */
/** @method flags=jni */
@@ -1912,6 +1927,7 @@ public static final long /*int*/ sel_setDelegate_ = sel_registerName("setDelegat
public static final long /*int*/ sel_setDestination_allowOverwrite_ = sel_registerName("setDestination:allowOverwrite:");
public static final long /*int*/ sel_setDictionary_ = sel_registerName("setDictionary:");
public static final long /*int*/ sel_setDirectory_ = sel_registerName("setDirectory:");
+public static final long /*int*/ sel_setDirectoryURL_ = sel_registerName("setDirectoryURL:");
public static final long /*int*/ sel_setDisplayMode_ = sel_registerName("setDisplayMode:");
public static final long /*int*/ sel_setDisplaysLinkToolTips_ = sel_registerName("setDisplaysLinkToolTips:");
public static final long /*int*/ sel_setDocumentCursor_ = sel_registerName("setDocumentCursor:");
@@ -2014,6 +2030,7 @@ public static final long /*int*/ sel_setMinimumFractionDigits_ = sel_registerNam
public static final long /*int*/ sel_setMinimumIntegerDigits_ = sel_registerName("setMinimumIntegerDigits:");
public static final long /*int*/ sel_setMiterLimit_ = sel_registerName("setMiterLimit:");
public static final long /*int*/ sel_setMovable_ = sel_registerName("setMovable:");
+public static final long /*int*/ sel_setNameFieldStringValue_ = sel_registerName("setNameFieldStringValue:");
public static final long /*int*/ sel_setNeedsDisplay_ = sel_registerName("setNeedsDisplay:");
public static final long /*int*/ sel_setNeedsDisplayInRect_ = sel_registerName("setNeedsDisplayInRect:");
public static final long /*int*/ sel_setNumberOfVisibleItems_ = sel_registerName("setNumberOfVisibleItems:");
@@ -2136,6 +2153,7 @@ public static final long /*int*/ sel_statusItemWithLength_ = sel_registerName("s
public static final long /*int*/ sel_stop_ = sel_registerName("stop:");
public static final long /*int*/ sel_stopAnimation_ = sel_registerName("stopAnimation:");
public static final long /*int*/ sel_stopLoading_ = sel_registerName("stopLoading:");
+public static final long /*int*/ sel_stopModal = sel_registerName("stopModal");
public static final long /*int*/ sel_string = sel_registerName("string");
public static final long /*int*/ sel_stringByAddingPercentEscapesUsingEncoding_ = sel_registerName("stringByAddingPercentEscapesUsingEncoding:");
public static final long /*int*/ sel_stringByAppendingPathComponent_ = sel_registerName("stringByAppendingPathComponent:");
@@ -4405,4 +4423,5 @@ public static final native void memmove(long /*int*/ dest, NSSize src, long /*in
public static final native void memmove(NSSize dest, long /*int*/ src, long /*int*/ size);
/** This section is auto generated */
+
}

Back to the top