ChangeApplier (@NotNull List<? extends @NotNull VFileEvent> events) { Int2ObjectMap<VirtualFile> deletedFiles = new Int2ObjectOpenHashMap<>(); for (VFileEvent event : events) { if (event instanceof VFileDeleteEvent) { collectFilesRecursively(((VFileDeleteEvent)event).getFile(), deletedFiles); } } return new ChangeApplier() { @Override public void beforeVfsChange() { for (VirtualFile file : deletedFiles.values()) { myEventMerger.recordFileRemovedEvent(file); } } @Override public void afterVfsChange() { processAfterEvents(events); } }; }