mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
platform: better pairing of before/after VFS events
This commit is contained in:
+7
-7
@@ -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<VFileContentChangeEvent> 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<VFileContentChangeEvent> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user