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 / UnixFileSystemView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.4 KB  |  90 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 UnixFileSystemView 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.       String var2 = var1.getAbsolutePath();
  17.       return var2.length() == 1 && var2.charAt(0) == '/';
  18.    }
  19.  
  20.    public File createNewFolder(File var1) throws IOException {
  21.       if (var1 == null) {
  22.          throw new IOException("Containing directory is null:");
  23.       } else {
  24.          Object var2 = null;
  25.          File var4 = ((FileSystemView)this).createFileObject(var1, "NewFolder");
  26.  
  27.          for(int var3 = 1; var4.exists() && var3 < 100; ++var3) {
  28.             var4 = ((FileSystemView)this).createFileObject(var1, "NewFolder." + var3);
  29.          }
  30.  
  31.          if (var4.exists()) {
  32.             throw new IOException("Directory already exists:" + var4.getAbsolutePath());
  33.          } else {
  34.             var4.mkdirs();
  35.             return var4;
  36.          }
  37.       }
  38.    }
  39.  
  40.    public boolean isHiddenFile(File var1) {
  41.       if (var1 != null) {
  42.          String var2 = var1.getName();
  43.          return var2.charAt(0) == '.';
  44.       } else {
  45.          return false;
  46.       }
  47.    }
  48.  
  49.    public File[] getRoots() {
  50.       if (!listRootsMethodChecked) {
  51.          try {
  52.             listRootsMethod = (class$java$io$File == null ? (class$java$io$File = class$("java.io.File")) : class$java$io$File).getMethod("listRoots", noArgTypes);
  53.          } catch (NoSuchMethodException var7) {
  54.          } finally {
  55.             listRootsMethodChecked = true;
  56.          }
  57.       }
  58.  
  59.       if (listRootsMethod != null) {
  60.          try {
  61.             File[] var1 = (File[])listRootsMethod.invoke((Object)null, noArgs);
  62.  
  63.             for(int var2 = 0; var2 < var1.length; ++var2) {
  64.                var1[var2] = new FileSystemRoot(var1[var2]);
  65.             }
  66.  
  67.             return var1;
  68.          } catch (Exception var9) {
  69.             ((Throwable)var9).printStackTrace();
  70.          }
  71.       } else {
  72.          File[] var10 = new File[]{new File("/")};
  73.          if (var10[0].exists() && var10[0].isDirectory()) {
  74.             return var10;
  75.          }
  76.       }
  77.  
  78.       return null;
  79.    }
  80.  
  81.    // $FF: synthetic method
  82.    static Class class$(String var0) {
  83.       try {
  84.          return Class.forName(var0);
  85.       } catch (ClassNotFoundException var2) {
  86.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  87.       }
  88.    }
  89. }
  90.