if(isPerformingIO()) { GUIUtilities.error(view,"buffer-multiple-io",null); return false; }  if(path == null && getFlag(NEW_FILE)) return saveAs(view,rename);  if(path == null && file != null) { long newModTime = file.lastModified();  if(newModTime != modTime) { Object[] args = { this.path }; int result = GUIUtilities.confirm(view, "filechanged-save",args, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if(result != JOptionPane.YES_OPTION) return false; } }  setFlag(IO,true); EditBus.send(new BufferUpdate(this,view,BufferUpdate.SAVING));  if(path == null) path = this.path;     VFS vfs = VFSManager.getVFSForPath(path);  if(!vfs.save(view,this,path)) { setFlag(IO,false); return false; }  final String oldPath = this.path; if(rename) setPath(path);   VFSManager.runInAWTThread(new Runnable() { public void run() {   if(getFlag(NEW_FILE) || !getPath().equals(oldPath)) VFSManager.sendVFSUpdate(getVFS(),getPath(),true);  setFlag(IO,false);  if(rename) {      try { writeLock();  if(autosaveFile != null) autosaveFile.delete();  setFlag(AUTOSAVE_DIRTY,false); setFlag(READ_ONLY,false); setFlag(NEW_FILE,false); setFlag(UNTITLED,false); setFlag(DIRTY,false);     undoMgr.bufferSaved(); } finally { writeUnlock(); }  parseBufferLocalProperties();  if(!getPath().equals(oldPath)) { jEdit.updatePosition(Buffer.this); setMode(); } else propertiesChanged();  if(file != null) modTime = file.lastModified();  EditBus.send(new BufferUpdate(Buffer.this, view,BufferUpdate.DIRTY_CHANGED));   EditBus.send(new BufferUpdate(Buffer.this, view,BufferUpdate.SAVED)); } } });  return true;
return save(view,path,true);
	public boolean save(final View view, String path, final boolean rename)	{		if(isPerformingIO())		{			GUIUtilities.error(view,"buffer-multiple-io",null);			return false;		}		if(path == null && getFlag(NEW_FILE))			return saveAs(view,rename);		if(path == null && file != null)		{			long newModTime = file.lastModified();			if(newModTime != modTime)			{				Object[] args = { this.path };				int result = GUIUtilities.confirm(view,					"filechanged-save",args,					JOptionPane.YES_NO_OPTION,					JOptionPane.WARNING_MESSAGE);				if(result != JOptionPane.YES_OPTION)					return false;			}		}		setFlag(IO,true);		EditBus.send(new BufferUpdate(this,view,BufferUpdate.SAVING));		if(path == null)			path = this.path;		// can't call setPath() here because we don't want a failed		// 'save as' to change the buffer's path, so obtain the VFS		// instance 'manually'		VFS vfs = VFSManager.getVFSForPath(path);		if(!vfs.save(view,this,path))		{			setFlag(IO,false);			return false;		}		final String oldPath = this.path;		if(rename)			setPath(path);		// Once save is complete, do a few other things		VFSManager.runInAWTThread(new Runnable()		{			public void run()			{				// Saving a NEW_FILE will create a file on				// disk, thus file system browsers must reload				if(getFlag(NEW_FILE) || !getPath().equals(oldPath))					VFSManager.sendVFSUpdate(getVFS(),getPath(),true);				setFlag(IO,false);				if(rename)				{					// we do a write lock so that the					// autosave, which grabs a read lock,					// is not executed between the					// deletion of the autosave file					// and clearing of the dirty flag					try					{						writeLock();						if(autosaveFile != null)							autosaveFile.delete();						setFlag(AUTOSAVE_DIRTY,false);						setFlag(READ_ONLY,false);						setFlag(NEW_FILE,false);						setFlag(UNTITLED,false);						setFlag(DIRTY,false);						// this ensures that undo can clear						// the dirty flag properly when all						// edits up to a save are undone						undoMgr.bufferSaved();					}					finally					{						writeUnlock();					}					parseBufferLocalProperties();					if(!getPath().equals(oldPath))					{						jEdit.updatePosition(Buffer.this);						setMode();					}					else						propertiesChanged();					if(file != null)						modTime = file.lastModified();					EditBus.send(new BufferUpdate(Buffer.this,						view,BufferUpdate.DIRTY_CHANGED));					// new message type introduced in 4.0pre4					EditBus.send(new BufferUpdate(Buffer.this,						view,BufferUpdate.SAVED));				}			}		});		return true;	} //}}}