home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / filechooser / GenericFileSystemView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.6 KB  |  86 lines

  1. package javax.swing.filechooser;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.lang.reflect.Method;
  6.  
  7. class GenericFileSystemView extends FileSystemView {
  8.    private static final Object[] noArgs = new Object[0];
  9.    private static final Class[] noArgTypes = new Class[0];
  10.    private static Method listRootsMethod = null;
  11.    private static boolean listRootsMethodChecked = false;
  12.    // $FF: synthetic field
  13.    static Class class$java$io$File;
  14.  
  15.    // $FF: synthetic method
  16.    static Class class$(String var0) {
  17.       try {
  18.          return Class.forName(var0);
  19.       } catch (ClassNotFoundException var2) {
  20.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  21.       }
  22.    }
  23.  
  24.    public File createNewFolder(File var1) throws IOException {
  25.       if (var1 == null) {
  26.          throw new IOException("Containing directory is null:");
  27.       } else {
  28.          Object var2 = null;
  29.          File var3 = ((FileSystemView)this).createFileObject(var1, "NewFolder");
  30.          if (var3.exists()) {
  31.             throw new IOException("Directory already exists:" + var3.getAbsolutePath());
  32.          } else {
  33.             var3.mkdirs();
  34.             return var3;
  35.          }
  36.       }
  37.    }
  38.  
  39.    public File[] getRoots() {
  40.       if (!listRootsMethodChecked) {
  41.          try {
  42.             listRootsMethod = (class$java$io$File != null ? class$java$io$File : (class$java$io$File = class$("java.io.File"))).getMethod("listRoots", noArgTypes);
  43.          } catch (NoSuchMethodException var6) {
  44.          } finally {
  45.             listRootsMethodChecked = true;
  46.          }
  47.       }
  48.  
  49.       if (listRootsMethod != null) {
  50.          try {
  51.             File[] var9 = (File[])listRootsMethod.invoke((Object)null, noArgs);
  52.  
  53.             for(int var2 = 0; var2 < var9.length; ++var2) {
  54.                var9[var2] = new FileSystemRoot(var9[var2]);
  55.             }
  56.  
  57.             return var9;
  58.          } catch (Exception var8) {
  59.             ((Throwable)var8).printStackTrace();
  60.             return null;
  61.          }
  62.       } else {
  63.          File[] var1 = new File[0];
  64.          return var1;
  65.       }
  66.    }
  67.  
  68.    public boolean isHiddenFile(File var1) {
  69.       return false;
  70.    }
  71.  
  72.    public boolean isRoot(File var1) {
  73.       if (!var1.isAbsolute()) {
  74.          return false;
  75.       } else {
  76.          String var2 = var1.getParent();
  77.          if (var2 == null) {
  78.             return true;
  79.          } else {
  80.             File var3 = new File(var2);
  81.             return var3.equals(var1);
  82.          }
  83.       }
  84.    }
  85. }
  86.