1 18 19 package org.apache.jmeter.gui; 20 21 import java.io.File ; 22 import java.util.Arrays ; 23 24 31 public class JMeterFileFilter 32 extends javax.swing.filechooser.FileFilter 33 implements java.io.FileFilter 34 { 35 36 private String [] exts; 37 38 45 public JMeterFileFilter(String [] extensions) 46 { 47 exts = extensions; 48 } 49 50 60 public boolean accept(File f) 61 { 62 return f.isDirectory() || accept(f.getName().toLowerCase()); 63 } 64 65 75 public boolean accept(String filename) 76 { 77 if (exts.length == 0) 78 { 79 return true; 80 } 81 82 for (int i = 0; i < exts.length; i++) 83 { 84 if (filename.endsWith(exts[i])) 85 { 86 return true; 87 } 88 } 89 90 return false; 91 } 92 93 98 public String getDescription() 99 { 100 return "JMeter " + Arrays.asList(exts).toString(); 101 } 102 } 103 | Popular Tags |