1 22 23 package org.gjt.sp.jedit.search; 24 25 import org.gjt.sp.jedit.Buffer; 26 import org.gjt.sp.jedit.EditPane; 27 import org.gjt.sp.jedit.MiscUtilities; 28 import org.gjt.sp.jedit.jEdit; 29 30 35 public class HyperSearchFileNode implements HyperSearchNode 36 { 37 public String path; 38 public Buffer buffer; 39 public boolean showFullPath = true; 40 41 private static String fileSep = System.getProperty("file.separator"); 42 static 43 { 44 if (fileSep.equals("\\")) 45 fileSep = "\\\\"; 46 } 47 48 public HyperSearchFileNode(String path) 50 { 51 this.path = path; 52 } 54 public Buffer getBuffer() 56 { 57 if(buffer == null) 58 buffer = jEdit.openFile(null,path); 59 return buffer; 60 } 62 public void goTo(EditPane editPane) 64 { 65 Buffer buffer = getBuffer(); 66 if(buffer == null) 67 return; 68 69 editPane.setBuffer(buffer); 70 } 72 public String toString() 74 { 75 if (showFullPath) 76 return path; 77 String [] paths = path.split(fileSep); 78 return paths[paths.length - 1]; 79 } 81 public boolean equals(Object compareObj) 83 { 84 if (!(compareObj instanceof HyperSearchFileNode)) 85 return false; 86 HyperSearchFileNode otherResult = (HyperSearchFileNode)compareObj; 87 88 return path.equals(MiscUtilities.resolveSymlinks(otherResult.path)) 89 && buffer.equals(otherResult.buffer); 90 } 92 98 public int getCount() 99 { 100 return count; 101 } 102 103 109 public void setCount(int count) 110 { 111 this.count = count; 112 } 113 114 private int count; 115 } 116 | Popular Tags |