1 19 20 package org.netbeans.modules.websvc.registry.ui; 21 22 import javax.swing.filechooser.FileFilter ; 23 import java.io.File ; 24 25 28 public class WSDLFileFilter extends FileFilter { 29 30 public final static String wsdl = "wsdl"; 32 34 public boolean accept(File f) { 35 if (f.isDirectory()) { 36 return true; 37 } 38 39 String extension = getExtension(f); 40 if (extension != null) { 41 if (extension.equals(wsdl)) { 42 return true; 43 } else { 44 return false; 45 } 46 } 47 48 return false; 49 } 50 51 public String getExtension(File f) { 52 String ext = null; 53 String s = f.getName(); 54 int i = s.lastIndexOf('.'); 55 56 if (i > 0 && i < s.length() - 1) { 57 ext = s.substring(i+1).toLowerCase(); 58 } 59 return ext; 60 } 61 62 63 public String getDescription() { 64 return "Web Services Descriptor File (.wsdl)"; 65 } 66 } | Popular Tags |