< prev index next >

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

Print this page




 205 
 206     static {
 207         String managerClassName = (String)Toolkit.getDefaultToolkit().
 208                                       getDesktopProperty("Shell.shellFolderManager");
 209         Class<?> managerClass = null;
 210         try {
 211             managerClass = Class.forName(managerClassName, false, null);
 212             if (!ShellFolderManager.class.isAssignableFrom(managerClass)) {
 213                 managerClass = null;
 214             }
 215         // swallow the exceptions below and use default shell folder
 216         } catch(ClassNotFoundException e) {
 217         } catch(NullPointerException e) {
 218         } catch(SecurityException e) {
 219         }
 220 
 221         if (managerClass == null) {
 222             managerClass = ShellFolderManager.class;
 223         }
 224         try {
 225             shellFolderManager =
 226                 (ShellFolderManager)managerClass.newInstance();

 227         } catch (InstantiationException e) {
 228             throw new Error("Could not instantiate Shell Folder Manager: "
 229             + managerClass.getName());
 230         } catch (IllegalAccessException e) {
 231             throw new Error ("Could not access Shell Folder Manager: "
 232             + managerClass.getName());
 233         }
 234 
 235         invoker = shellFolderManager.createInvoker();
 236     }
 237 
 238     /**
 239      * Return a shell folder from a file object
 240      * @exception FileNotFoundException if file does not exist
 241      */
 242     public static ShellFolder getShellFolder(File file) throws FileNotFoundException {
 243         if (file instanceof ShellFolder) {
 244             return (ShellFolder)file;
 245         }
 246         if (!file.exists()) {




 205 
 206     static {
 207         String managerClassName = (String)Toolkit.getDefaultToolkit().
 208                                       getDesktopProperty("Shell.shellFolderManager");
 209         Class<?> managerClass = null;
 210         try {
 211             managerClass = Class.forName(managerClassName, false, null);
 212             if (!ShellFolderManager.class.isAssignableFrom(managerClass)) {
 213                 managerClass = null;
 214             }
 215         // swallow the exceptions below and use default shell folder
 216         } catch(ClassNotFoundException e) {
 217         } catch(NullPointerException e) {
 218         } catch(SecurityException e) {
 219         }
 220 
 221         if (managerClass == null) {
 222             managerClass = ShellFolderManager.class;
 223         }
 224         try {
 225             @SuppressWarnings("deprecation")
 226             Object tmp = managerClass.newInstance();
 227             shellFolderManager = (ShellFolderManager)tmp;
 228         } catch (InstantiationException e) {
 229             throw new Error("Could not instantiate Shell Folder Manager: "
 230             + managerClass.getName());
 231         } catch (IllegalAccessException e) {
 232             throw new Error ("Could not access Shell Folder Manager: "
 233             + managerClass.getName());
 234         }
 235 
 236         invoker = shellFolderManager.createInvoker();
 237     }
 238 
 239     /**
 240      * Return a shell folder from a file object
 241      * @exception FileNotFoundException if file does not exist
 242      */
 243     public static ShellFolder getShellFolder(File file) throws FileNotFoundException {
 244         if (file instanceof ShellFolder) {
 245             return (ShellFolder)file;
 246         }
 247         if (!file.exists()) {


< prev index next >