1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* JSampler is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with JSampler; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.jsampler.view; |
24 |
|
25 |
import java.io.File; |
26 |
|
27 |
import javax.swing.filechooser.FileFilter; |
28 |
|
29 |
/** |
30 |
* A file filter for LSCP script files. |
31 |
* @author Grigor Iliev |
32 |
*/ |
33 |
public class LscpFileFilter extends FileFilter { |
34 |
|
35 |
/** Creates a new instance of LscpFileFilter */ |
36 |
public LscpFileFilter() { |
37 |
} |
38 |
|
39 |
/** |
40 |
* Returns <code>true</code> if the specified file is a LSCP script. |
41 |
* The file is recognized by its extension. |
42 |
* @return <code>true</code> if the specified file is a LSCP script; |
43 |
* <code>false</code> otherwise. |
44 |
*/ |
45 |
public boolean |
46 |
accept(File f) { |
47 |
if(f.isDirectory()) return true; |
48 |
String s = f.getName(); |
49 |
int i = s.lastIndexOf('.'); |
50 |
if(i == -1) return false; |
51 |
s = s.substring(i); |
52 |
|
53 |
return s.equalsIgnoreCase(".lscp"); |
54 |
} |
55 |
|
56 |
/** |
57 |
* The description of this filter. |
58 |
* @return The description of this filter: <b>LSCP Script Files (*.lscp)</b>. |
59 |
*/ |
60 |
public String |
61 |
getDescription() { return "LSCP Script Files (*.lscp)"; } |
62 |
} |