01: //Copyright (c) Janna Khegai 2004, Hans-Joachim Daniels 2005
02: //
03: //This program is free software; you can redistribute it and/or modify
04: //it under the terms of the GNU General Public License as published by
05: //the Free Software Foundation; either version 2 of the License, or
06: //(at your option) any later version.
07: //
08: //This program is distributed in the hope that it will be useful,
09: //but WITHOUT ANY WARRANTY; without even the implied warranty of
10: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: //GNU General Public License for more details.
12: //
13: //You can either finde the file LICENSE or LICENSE.TXT in the source
14: //distribution or in the .jar file of this application
15:
16: package de.uka.ilkd.key.ocl.gf;
17:
18: import java.io.File;
19:
20: import javax.swing.filechooser.FileFilter;
21:
22: public class GrammarFilter extends FileFilter {
23:
24: // Accept all directories and all gf, gfcm files.
25: public boolean accept(File f) {
26: if (f.isDirectory()) {
27: return true;
28: }
29:
30: String extension = Utils.getExtension(f);
31: if (extension != null) {
32: if (extension.equals(Utils.gf)
33: || extension.equals(Utils.gfcm)) {
34: return true;
35: } else {
36: return false;
37: }
38: }
39:
40: return false;
41: }
42:
43: // The description of this filter
44: public String getDescription() {
45: return "Just Grammars (*.gf, *.gfcm)";
46: }
47: }
|