jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
changeset 4913 9b3caa50afcf
parent 3938 ef327bd847c0
child 5506 202f599c92aa
--- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Mon Feb 08 17:02:43 2010 +0300
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Fri Feb 12 19:58:10 2010 +0300
@@ -37,6 +37,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import sun.util.logging.PlatformLogger;
+import sun.awt.AWTAccessor;
 
 class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListener, ItemListener, KeyEventDispatcher, XChoicePeerListener {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XFileDialogPeer");
@@ -171,6 +172,10 @@
         filterField = new TextField();
         selectionField = new TextField();
 
+        boolean isMultipleMode =
+            AWTAccessor.getFileDialogAccessor().isMultipleMode(target);
+        fileList.setMultipleMode(isMultipleMode);
+
         // the insets used by the components in the fileDialog
         Insets noInset = new Insets(0, 0, 0, 0);
         Insets textFieldInset = new Insets(0, 8, 0, 8);
@@ -380,7 +385,8 @@
      * handle the selection event
      */
     void handleSelection(String file) {
-        int index = file.lastIndexOf('/');
+
+        int index = file.lastIndexOf(java.io.File.separatorChar);
 
         if (index == -1) {
             savedDir = this.dir;
@@ -389,8 +395,12 @@
             savedDir = file.substring(0, index+1);
             savedFile = file.substring(index+1);
         }
-        target.setDirectory(savedDir);
-        target.setFile(savedFile);
+
+        AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor();
+
+        fileDialogAccessor.setDirectory(target, savedDir);
+        fileDialogAccessor.setFile(target, savedFile);
+        fileDialogAccessor.setFiles(target, savedDir, fileList.getSelectedItems());
     }
 
     /**
@@ -404,8 +414,13 @@
         setFilterField(null);
         directoryList.clear();
         fileList.clear();
-        target.setFile(null);
-        target.setDirectory(null);
+
+        AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor();
+
+        fileDialogAccessor.setDirectory(target, null);
+        fileDialogAccessor.setFile(target, null);
+        fileDialogAccessor.setFiles(target, null, null);
+
         handleQuitButton();
     }