Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

FileChooser.java

00001 package edu.ksu.cis.bandera.bui;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 2000   Robby (robby@cis.ksu.edu)                    *
00006  * All rights reserved.                                              *
00007  *                                                                   *
00008  * This work was done as a project in the SAnToS Laboratory,         *
00009  * Department of Computing and Information Sciences, Kansas State    *
00010  * University, USA (http://www.cis.ksu.edu/santos).                  *
00011  * It is understood that any modification not identified as such is  *
00012  * not covered by the preceding statement.                           *
00013  *                                                                   *
00014  * This work is free software; you can redistribute it and/or        *
00015  * modify it under the terms of the GNU Library General Public       *
00016  * License as published by the Free Software Foundation; either      *
00017  * version 2 of the License, or (at your option) any later version.  *
00018  *                                                                   *
00019  * This work is distributed in the hope that it will be useful,      *
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
00022  * Library General Public License for more details.                  *
00023  *                                                                   *
00024  * You should have received a copy of the GNU Library General Public *
00025  * License along with this toolkit; if not, write to the             *
00026  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,      *
00027  * Boston, MA  02111-1307, USA.                                      *
00028  *                                                                   *
00029  * Java is a trademark of Sun Microsystems, Inc.                     *
00030  *                                                                   *
00031  * To submit a bug report, send a comment, or get the latest news on *
00032  * this project and other SAnToS projects, please visit the web-site *
00033  *                http://www.cis.ksu.edu/santos                      *
00034  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00035 import javax.swing.*;
00036 import javax.swing.filechooser.*;
00037 
00038 public class FileChooser extends JFileChooser {
00039     public static FileChooser chooser;
00040     public static FileFilter ALL;
00041     public static FileFilter JAVA;
00042     public static FileFilter CLASSPATH;
00043     public static FileFilter PATTERN;
00044     public static FileFilter DIRECTORY;
00045     public static FileFilter SESSION;
00046     public static FileFilter SPECIFICATION;
00047     public static FileFilter ABSTRACTION;
00048     public static FileFilter BASL;
00049     public static FileFilter CLASS;
00050 /**
00051  * FileChooser constructor comment.
00052  */
00053 private FileChooser() {
00054 }
00055 /**
00056  * 
00057  */
00058 public static void initialize() {
00059     chooser = new FileChooser();
00060     class AllFilter extends FileFilter {
00061         public String ext = "*.*";
00062         public String description = "All files";
00063         public boolean accept(java.io.File f) {
00064             if (f != null) {
00065                 if (f.isDirectory())
00066                     return true;
00067                 else
00068                     if (ext == null)
00069                         return false;
00070                     else
00071                         if (("*.*".equals(ext)) || f.getAbsolutePath().endsWith(ext))
00072                             return true;
00073             }
00074             return false;
00075         }
00076         public String getDescription() {
00077             return description;
00078         }
00079     };
00080     class JavaFilter extends FileFilter {
00081         public boolean accept(java.io.File f) {
00082             if (f != null) {
00083                 if (f.isDirectory())
00084                     return true;
00085                 else
00086                     if (f.getAbsolutePath().endsWith(".java"))
00087                         return true;
00088             }
00089             return false;
00090         }
00091         public String getDescription() {
00092             return "Java source code";
00093         }
00094     };
00095     class ClasspathFilter extends FileFilter {
00096         public boolean accept(java.io.File f) {
00097             if (f != null) {
00098                 if (f.isDirectory())
00099                     return true;
00100                 else
00101                     if (f.getAbsolutePath().endsWith(".jar") || f.getAbsolutePath().endsWith(".zip"))
00102                         return true;
00103             }
00104             return false;
00105         }
00106         public String getDescription() {
00107             return "Jar files, Zip files and directories";
00108         }
00109     };
00110     class PatternFilter extends FileFilter {
00111         public boolean accept(java.io.File f) {
00112             if (f != null) {
00113                 if (f.isDirectory())
00114                     return true;
00115                 else
00116                     if (f.getAbsolutePath().endsWith(".pattern"))
00117                         return true;
00118             }
00119             return false;
00120         }
00121         public String getDescription() {
00122             return "Pattern file";
00123         }
00124     };
00125     class SpecificationFilter extends FileFilter {
00126         public boolean accept(java.io.File f) {
00127             if (f != null) {
00128                 if (f.isDirectory())
00129                     return true;
00130                 else
00131                     if (f.getAbsolutePath().endsWith(".specification"))
00132                         return true;
00133             }
00134             return false;
00135         }
00136         public String getDescription() {
00137             return "Specification file";
00138         }
00139     };
00140     class DirectoryFilter extends FileFilter {
00141         public boolean accept(java.io.File f) {
00142             if (f != null) {
00143                 if (f.isDirectory())
00144                     return true;
00145                 else
00146                     return false;
00147             }
00148             return false;
00149         }
00150         public String getDescription() {
00151             return "Directory";
00152         }
00153     };
00154     class SessionFilter extends FileFilter {
00155         public boolean accept(java.io.File f) {
00156             if (f != null) {
00157                 if (f.isDirectory())
00158                     return true;
00159                 else
00160                     if (f.getAbsolutePath().endsWith(".session"))
00161                         return true;
00162             }
00163             return false;
00164         }
00165         public String getDescription() {
00166             return "Session file";
00167         }
00168     };
00169     class AbstractionFilter extends FileFilter {
00170         public boolean accept(java.io.File f) {
00171             if (f != null) {
00172                 if (f.isDirectory())
00173                     return true;
00174                 else
00175                     if (f.getAbsolutePath().endsWith(".abstraction"))
00176                         return true;
00177             }
00178             return false;
00179         }
00180         public String getDescription() {
00181             return "Abstraction file";
00182         }
00183     };
00184     class BASLFilter extends FileFilter {
00185         public boolean accept(java.io.File f) {
00186             if (f != null) {
00187                 if (f.isDirectory())
00188                     return true;
00189                 else
00190                     if (f.getAbsolutePath().endsWith(".basl"))
00191                         return true;
00192             }
00193             return false;
00194         }
00195         public String getDescription() {
00196             return "BASL file";
00197         }
00198     };
00199     class ClassFilter extends FileFilter {
00200         public boolean accept(java.io.File f) {
00201             if (f != null) {
00202                 if (f.isDirectory())
00203                     return true;
00204                 else
00205                     if (f.getAbsolutePath().endsWith(".class"))
00206                         return true;
00207             }
00208             return false;
00209         }
00210         public String getDescription() {
00211             return "Java class file";
00212         }
00213     };
00214     ALL = new AllFilter();
00215     JAVA = new JavaFilter();
00216     CLASSPATH = new ClasspathFilter();
00217     PATTERN = new PatternFilter();
00218     SPECIFICATION = new SpecificationFilter();
00219     DIRECTORY = new DirectoryFilter();
00220     SESSION = new SessionFilter();
00221     ABSTRACTION = new AbstractionFilter();
00222     BASL = new BASLFilter();
00223     CLASS = new ClassFilter();
00224 }
00225 }

Generated at Thu Feb 7 06:45:43 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001