8021379: JFileChooser Create New Folder button enabled in write proteced directory
authormalenkov
Tue, 27 Aug 2013 13:13:32 +0400
changeset 20099 fe931b18962c
parent 20098 7b11536bf6b3
child 20100 d127097b7717
8021379: JFileChooser Create New Folder button enabled in write proteced directory Reviewed-by: alexsch
jdk/src/share/classes/sun/swing/FilePane.java
--- a/jdk/src/share/classes/sun/swing/FilePane.java	Tue Aug 27 12:53:46 2013 +0400
+++ b/jdk/src/share/classes/sun/swing/FilePane.java	Tue Aug 27 13:13:32 2013 +0400
@@ -1980,18 +1980,18 @@
         }
 
         if (f instanceof ShellFolder) {
-            return ((ShellFolder) f).isFileSystem();
+            return f.canWrite();
         } else {
             if (usesShellFolder(getFileChooser())) {
                 try {
-                    return ShellFolder.getShellFolder(f).isFileSystem();
+                    return ShellFolder.getShellFolder(f).canWrite();
                 } catch (FileNotFoundException ex) {
                     // File doesn't exist
                     return false;
                 }
             } else {
                 // Ordinary file
-                return true;
+                return f.canWrite();
             }
         }
     }