aboutsummaryrefslogtreecommitdiff
path: root/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/macosx/classes/sun/lwawt/macosx/CFileDialog.java')
-rw-r--r--src/macosx/classes/sun/lwawt/macosx/CFileDialog.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java b/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
index cc31b532f7..4f82c75551 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
@@ -37,6 +37,7 @@ import java.io.*;
import sun.awt.CausedFocusEvent.Cause;
import sun.awt.AWTAccessor;
import sun.java2d.pipe.Region;
+import sun.lwawt.LWWindowPeer;
import sun.security.action.GetBooleanAction;
class CFileDialog implements FileDialogPeer {
@@ -57,7 +58,13 @@ class CFileDialog implements FileDialogPeer {
title = " ";
}
- String[] userFileNames = nativeRunFileDialog(title,
+ Window owner = target.getOwner();
+
+ long ownerPtr = owner == null ? 0L :((CPlatformWindow) (((LWWindowPeer)owner.getPeer())).getPlatformWindow()).getNSWindowPtr();
+
+ String[] userFileNames = nativeRunFileDialog(
+ ownerPtr,
+ title,
dialogMode,
target.isMultipleMode(),
navigateApps,
@@ -70,7 +77,7 @@ class CFileDialog implements FileDialogPeer {
String file = null;
File[] files = null;
- if (userFileNames != null) {
+ if (userFileNames != null && userFileNames.length > 0) {
// the dialog wasn't cancelled
int filesNumber = userFileNames.length;
files = new File[filesNumber];
@@ -145,7 +152,7 @@ class CFileDialog implements FileDialogPeer {
return ret;
}
- private native String[] nativeRunFileDialog(String title, int mode,
+ private native String[] nativeRunFileDialog(long ownerPtr, String title, int mode,
boolean multipleMode, boolean shouldNavigateApps,
boolean canChooseDirectories, boolean hasFilenameFilter,
String directory, String file);