ChangeApplier (@NotNull List<? extends @NotNull VFileEvent> events) { if (myProject.isDisposed()) return null; List<Module> modulesToBeMarkedDirty = getModulesToBeMarkedDirtyBefore(events); return new ChangeApplier() { @Override public void beforeVfsChange() { modulesToBeMarkedDirty.forEach(DirtyScopeHolder.this::addToDirtyModules); } @Override public void afterVfsChange() { if (!myProject.isDisposed()) { after(events); } } }; }