1 22 23 package org.gjt.sp.jedit.bufferio; 24 25 import java.io.*; 27 import org.gjt.sp.jedit.io.*; 28 import org.gjt.sp.jedit.*; 29 import org.gjt.sp.util.*; 30 32 37 public class BufferAutosaveRequest extends BufferIORequest 38 { 39 48 public BufferAutosaveRequest(View view, Buffer buffer, 49 Object session, VFS vfs, String path) 50 { 51 super(view,buffer,session,vfs,path); 52 } 54 public void run() 56 { 57 OutputStream out = null; 58 59 try 60 { 61 String [] args = { vfs.getFileName(path) }; 62 setStatus(jEdit.getProperty("vfs.status.autosave",args)); 63 64 setAbortable(true); 66 67 try 68 { 69 71 if(!buffer.isDirty()) 72 { 73 return; 76 } 77 78 out = vfs._createOutputStream(session,path,view); 79 if(out == null) 80 return; 81 82 write(buffer,out); 83 } 84 catch(Exception e) 85 { 86 } 87 } 92 catch(WorkThread.Abort a) 93 { 94 } 95 finally 96 { 97 IOUtilities.closeQuietly(out); 98 } 99 } } 101 | Popular Tags |