1 33 34 package edu.rice.cs.drjava.ui; 35 36 import java.io.File ; 37 import javax.swing.filechooser.FileFilter ; 38 39 40 45 public class InteractionsHistoryFilter extends FileFilter { 46 47 50 public static final String HIST_EXTENSION = "hist"; 51 52 55 public boolean accept(File f) { 56 if (f.isDirectory()) { 57 return true; 58 } 59 String ext = getExtension(f); 60 if ((ext != null) && (ext.equals(HIST_EXTENSION))) { 61 return true; 62 } 63 return false; 64 } 65 66 69 public String getDescription() { 70 return "Interaction History Files"; 71 } 72 73 76 public static String getExtension(File f) { 77 String ext = null; 78 String s = f.getName(); 79 int i = s.lastIndexOf('.'); 80 if (i > 0 && i < s.length() - 1) { 81 ext = s.substring(i + 1).toLowerCase(); 82 } 83 return ext; 84 } 85 } 86 87 88 89 | Popular Tags |