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 / WindowsFileSystemView.class (.txt) < prev   
Encoding:
Java Class File  |  1979-12-31  |  2.7 KB  |  106 lines

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