PageRenderTime 145ms CodeModel.GetById 141ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/CommonControls/common/gui/pathbuilder/ClasspathFilter.java

#
Java | 49 lines | 21 code | 8 blank | 20 comment | 4 complexity | 2efac0fb20e5798499ea148f4bf242fe MD5 | raw file
 1package common.gui.pathbuilder;
 2
 3/*
 4 * PathBuilder.java
 5 * Part of the JSwat plugin for the jEdit text editor
 6 * Copyright (C) 2001 David Taylor
 7 * dtaylo11@bigpond.net.au
 8 *
 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24import java.io.File;
25import java.io.IOException;
26import javax.swing.filechooser.*;
27
28public class ClasspathFilter extends FileFilter {
29    public boolean accept(File f) {
30        if(f.isDirectory())
31            return true;
32
33        String fname = f.getName();
34        int fnameLength = fname.length();
35        if(fnameLength < 5)
36            return false;
37
38        String ext = fname.substring(fnameLength - 4, fnameLength);
39        if(ext.equalsIgnoreCase(".jar") || ext.equalsIgnoreCase(".zip"))
40            return true;
41
42        return false;
43    }
44
45    public String getDescription() {
46        return "Classpath elements (*.jar, *.zip)";
47    }
48}
49