From eaeed33efcc136fbabfcced424159ecfcab9b7ad Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 7 Nov 2013 18:45:05 +0100 Subject: [PATCH] platform: better pairing of before/after VFS events --- .../vfs/newvfs/persistent/PersistentFSImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java index a14f3022409e..62ab743ac908 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java @@ -635,20 +635,19 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone final Object requestor, final long modStamp, final long timeStamp) throws IOException { - final VFileContentChangeEvent event = new VFileContentChangeEvent(requestor, file, file.getModificationStamp(), modStamp, false); - - final List events = Collections.singletonList(event); - - final BulkFileListener publisher = myEventsBus.syncPublisher(VirtualFileManager.VFS_CHANGES); - publisher.before(events); - return new ByteArrayOutputStream() { private boolean closed; // protection against user calling .close() twice + @Override public void close() throws IOException { if (closed) return; super.close(); + VFileContentChangeEvent event = new VFileContentChangeEvent(requestor, file, file.getModificationStamp(), modStamp, false); + List events = Collections.singletonList(event); + BulkFileListener publisher = myEventsBus.syncPublisher(VirtualFileManager.VFS_CHANGES); + publisher.before(events); + NewVirtualFileSystem delegate = getDelegate(file); OutputStream ioFileStream = delegate.getOutputStream(file, requestor, modStamp, timeStamp); // FSRecords.ContentOutputStream already buffered, no need to wrap in BufferedStream @@ -665,6 +664,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone closed = true; persistenceStream.close(); ioFileStream.close(); + executeTouch(file, false, event.getModificationStamp()); publisher.after(events); }