ChangeApplier (@NotNull List<? extends @NotNull VFileEvent> events) { List<VirtualFile> deletedFiles = new NotNullList<>(); for (VFileEvent event : events) { if (event instanceof VFileDeleteEvent) { collectDeletedFiles(((VFileDeleteEvent)event).getFile(), deletedFiles); } } return new ChangeApplier() { @Override public void afterVfsChange() { for (VirtualFile each : deletedFiles) { fileDeleted(each); } for (VFileEvent event : events) { if (event instanceof VFileCreateEvent) { fileCreated((VFileCreateEvent)event); } } } }; }