< prev index next >

src/java.desktop/share/classes/sun/awt/shell/ShellFolderManager.java

Print this page




  68             // Return the default shellfolder for a new filechooser
  69             File homeDir = new File(System.getProperty("user.home"));
  70             try {
  71                 return createShellFolder(homeDir);
  72             } catch (FileNotFoundException e) {
  73                 return homeDir;
  74             }
  75         } else if (key.equals("roots")) {
  76             // The root(s) of the displayable hierarchy
  77             return File.listRoots();
  78         } else if (key.equals("fileChooserComboBoxFolders")) {
  79             // Return an array of ShellFolders representing the list to
  80             // show by default in the file chooser's combobox
  81             return get("roots");
  82         } else if (key.equals("fileChooserShortcutPanelFolders")) {
  83             // Return an array of ShellFolders representing well-known
  84             // folders, such as Desktop, Documents, History, Network, Home, etc.
  85             // This is used in the shortcut panel of the filechooser on Windows 2000
  86             // and Windows Me
  87             return new File[] { (File)get("fileChooserDefaultFolder") };



  88         }
  89         return null;
  90     }
  91 
  92     /**
  93      * Does {@code dir} represent a "computer" such as a node on the network, or
  94      * "My Computer" on the desktop.
  95      */
  96     public boolean isComputerNode(File dir) {
  97         return false;
  98     }
  99 
 100     public boolean isFileSystemRoot(File dir) {
 101         if (dir instanceof ShellFolder && !((ShellFolder) dir).isFileSystem()) {
 102             return false;
 103         }
 104         return (dir.getParentFile() == null);
 105     }
 106 
 107     protected ShellFolder.Invoker createInvoker() {


  68             // Return the default shellfolder for a new filechooser
  69             File homeDir = new File(System.getProperty("user.home"));
  70             try {
  71                 return createShellFolder(homeDir);
  72             } catch (FileNotFoundException e) {
  73                 return homeDir;
  74             }
  75         } else if (key.equals("roots")) {
  76             // The root(s) of the displayable hierarchy
  77             return File.listRoots();
  78         } else if (key.equals("fileChooserComboBoxFolders")) {
  79             // Return an array of ShellFolders representing the list to
  80             // show by default in the file chooser's combobox
  81             return get("roots");
  82         } else if (key.equals("fileChooserShortcutPanelFolders")) {
  83             // Return an array of ShellFolders representing well-known
  84             // folders, such as Desktop, Documents, History, Network, Home, etc.
  85             // This is used in the shortcut panel of the filechooser on Windows 2000
  86             // and Windows Me
  87             return new File[] { (File)get("fileChooserDefaultFolder") };
  88         } else if(key.startsWith("parseDisplayName ")) {
  89             String path = key.substring("parseDisplayName ".length());
  90             return new File(path);
  91         }
  92         return null;
  93     }
  94 
  95     /**
  96      * Does {@code dir} represent a "computer" such as a node on the network, or
  97      * "My Computer" on the desktop.
  98      */
  99     public boolean isComputerNode(File dir) {
 100         return false;
 101     }
 102 
 103     public boolean isFileSystemRoot(File dir) {
 104         if (dir instanceof ShellFolder && !((ShellFolder) dir).isFileSystem()) {
 105             return false;
 106         }
 107         return (dir.getParentFile() == null);
 108     }
 109 
 110     protected ShellFolder.Invoker createInvoker() {
< prev index next >