home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / filechooser / GenericFileSystemView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.3 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.    public boolean isRoot(File var1) {
  16.       if (!var1.isAbsolute()) {
  17.          return false;
  18.       } else {
  19.          String var2 = var1.getParent();
  20.          if (var2 == null) {
  21.             return true;
  22.          } else {
  23.             File var3 = new File(var2);
  24.             return var3.equals(var1);
  25.          }
  26.       }
  27.    }
  28.  
  29.    public File createNewFolder(File var1) throws IOException {
  30.       if (var1 == null) {
  31.          throw new IOException("Containing directory is null:");
  32.       } else {
  33.          Object var2 = null;
  34.          File var3 = ((FileSystemView)this).createFileObject(var1, "NewFolder");
  35.          if (var3.exists()) {
  36.             throw new IOException("Directory already exists:" + var3.getAbsolutePath());
  37.          } else {
  38.             var3.mkdirs();
  39.             return var3;
  40.          }
  41.       }
  42.    }
  43.  
  44.    public boolean isHiddenFile(File var1) {
  45.       return false;
  46.    }
  47.  
  48.    public File[] getRoots() {
  49.       if (!listRootsMethodChecked) {
  50.          try {
  51.             listRootsMethod = (class$java$io$File == null ? (class$java$io$File = class$("java.io.File")) : class$java$io$File).getMethod("listRoots", noArgTypes);
  52.          } catch (NoSuchMethodException var7) {
  53.          } finally {
  54.             listRootsMethodChecked = true;
  55.          }
  56.       }
  57.  
  58.       if (listRootsMethod != null) {
  59.          try {
  60.             File[] var10 = (File[])listRootsMethod.invoke((Object)null, noArgs);
  61.  
  62.             for(int var2 = 0; var2 < var10.length; ++var2) {
  63.                var10[var2] = new FileSystemRoot(var10[var2]);
  64.             }
  65.  
  66.             return var10;
  67.          } catch (Exception var9) {
  68.             ((Throwable)var9).printStackTrace();
  69.             return null;
  70.          }
  71.       } else {
  72.          File[] var1 = new File[0];
  73.          return var1;
  74.       }
  75.    }
  76.  
  77.    // $FF: synthetic method
  78.    static Class class$(String var0) {
  79.       try {
  80.          return Class.forName(var0);
  81.       } catch (ClassNotFoundException var2) {
  82.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  83.       }
  84.    }
  85. }
  86.