01: /*
02: * $RCSfile: VAIProjectFileFilter.java,v $
03: * @modification $Date: 2001/09/28 19:41:42 $
04: * @version $Id: VAIProjectFileFilter.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
05: *
06: */
07:
08: package com.memoire.vainstall.builder.util;
09:
10: import java.io.File;
11:
12: import javax.swing.filechooser.FileFilter;
13:
14: /**
15: * This is a FileFilter which only allows VAInstall builder project
16: * files to be selected.
17: *
18: * @see javax.swing.filechooser.FileFilter
19: *
20: * @author Henrik Falk
21: * @version $Id: VAIProjectFileFilter.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
22: */
23: public class VAIProjectFileFilter extends FileFilter {
24:
25: /**
26: * Default constructor
27: */
28: public VAIProjectFileFilter() {
29: super ();
30: }
31:
32: /**
33: * Implements the accept method for the FileFilter
34: * @param file The file provided by the FileChooser
35: * @return true if the file is accepted by the filter
36: */
37: public boolean accept(File file) {
38:
39: // we allow to browse through directories
40: if (file.isDirectory()) {
41: return true;
42: }
43:
44: // allow only 'vainstall.xml' files
45: if (file.getName().equals("vainstall.xml") == true) {
46: return true;
47: }
48: return false;
49: }
50:
51: /**
52: * Returns the description of the filefilter to the filechooser
53: * @return The description of this filefilter.
54: */
55: public String getDescription() {
56: return "VAInstall Project Files (vainstall.xml)";
57: }
58:
59: }
|