home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.filechooser;
-
- import java.io.File;
- import java.io.IOException;
- import java.lang.reflect.Method;
- import java.util.Vector;
-
- class WindowsFileSystemView extends FileSystemView {
- private static final Object[] noArgs = new Object[0];
- private static final Class[] noArgTypes = new Class[0];
- private static Method listRootsMethod = null;
- private static boolean listRootsMethodChecked = false;
- // $FF: synthetic field
- static Class class$java$io$File;
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
-
- public File createNewFolder(File var1) throws IOException {
- if (var1 == null) {
- throw new IOException("Containing directory is null:");
- } else {
- Object var2 = null;
- File var4 = ((FileSystemView)this).createFileObject(var1, "New Folder");
-
- for(int var3 = 2; var4.exists() && var3 < 100; ++var3) {
- var4 = ((FileSystemView)this).createFileObject(var1, "New Folder (" + var3 + ")");
- }
-
- if (var4.exists()) {
- throw new IOException("Directory already exists:" + var4.getAbsolutePath());
- } else {
- var4.mkdirs();
- return var4;
- }
- }
- }
-
- public File[] getRoots() {
- if (!listRootsMethodChecked) {
- try {
- listRootsMethod = (class$java$io$File != null ? class$java$io$File : (class$java$io$File = class$("java.io.File"))).getMethod("listRoots", noArgTypes);
- } catch (NoSuchMethodException var10) {
- } finally {
- listRootsMethodChecked = true;
- }
- }
-
- if (listRootsMethod != null) {
- try {
- File[] var13 = (File[])listRootsMethod.invoke((Object)null, noArgs);
-
- for(int var14 = 0; var14 < var13.length; ++var14) {
- var13[var14] = new FileSystemRoot(var13[var14]);
- }
-
- return var13;
- } catch (Exception var12) {
- ((Throwable)var12).printStackTrace();
- return null;
- }
- } else {
- Vector var1 = new Vector();
- FileSystemRoot var2 = new FileSystemRoot("A:\\");
- var1.addElement(var2);
-
- for(char var3 = 'C'; var3 <= 'Z'; ++var3) {
- char[] var4 = new char[]{var3, ':', '\\'};
- String var5 = new String(var4);
- FileSystemRoot var6 = new FileSystemRoot(var5);
- if (var6 != null && ((File)var6).exists()) {
- var1.addElement(var6);
- }
- }
-
- File[] var15 = new File[var1.size()];
- var1.copyInto(var15);
- return var15;
- }
- }
-
- public boolean isHiddenFile(File var1) {
- return false;
- }
-
- public boolean isRoot(File var1) {
- if (!var1.isAbsolute()) {
- return false;
- } else {
- String var2 = var1.getParent();
- if (var2 == null) {
- return true;
- } else {
- File var3 = new File(var2);
- return var3.equals(var1);
- }
- }
- }
- }
-