1 33 34 package edu.rice.cs.util.docnavigation; 35 36 import java.io.*; 37 38 39 public class FileNode<ItemT extends INavigatorItem> extends InnerNode<File, ItemT>{ 40 41 public FileNode(File f) { super(f); } 42 43 public void setData(File f){ super.setUserObject(f); } 44 45 public File getData(){ return (File) super.getUserObject(); } 46 47 public <Ret> Ret execute(NodeDataVisitor<? super ItemT, Ret> v, Object ... p) { return v.fileCase(getData(), p); } 48 49 public String toString() { 50 try { 51 String path = getData().getCanonicalPath(); 52 int index = path.lastIndexOf(File.separator); 53 path = path.substring(index+1); 54 return path; 55 } 56 catch(IOException e) { return getData().toString(); } 57 } 58 } 59 | Popular Tags |