1 19 package org.openharmonise.him.editors.filefilters; 20 21 import java.io.File ; 22 23 import javax.swing.filechooser.FileFilter ; 24 25 32 public class OfficeFilter extends FileFilter { 33 34 37 public OfficeFilter() { 38 super(); 39 } 40 41 44 public boolean accept(File file) { 45 if (file.isDirectory()) { 46 return true; 47 } 48 String sFilename = file.getName(); 49 if (sFilename.indexOf(".") > 0) { 50 String sExt = sFilename.substring(sFilename.indexOf(".") + 1); 51 if (sExt.length() > 0) { 52 if (sExt.equalsIgnoreCase("doc") 53 || sExt.equalsIgnoreCase("rtf") 54 || sExt.equalsIgnoreCase("txt") 55 || sExt.equalsIgnoreCase("xls") 56 || sExt.equalsIgnoreCase("ppt") 57 || sExt.equalsIgnoreCase("wp")) { 58 return true; 59 } 60 } 61 } 62 return false; 63 } 64 65 68 public String getDescription() { 69 return "Office Documents"; 70 } 71 72 } | Popular Tags |