void (Label label, boolean failed, Project project) { try { WriteAction.run(() -> { PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); new RunAll( () -> PostprocessReformattingAspect.getInstance(project).doPostponedFormatting(), () -> FileEditorManagerEx.getInstanceEx(project).closeAllFiles(), () -> EditorHistoryManager.getInstance(project).removeAllFiles(), () -> FileDocumentManager.getInstance().saveAllDocuments(), () -> revertVfs(label, project), () -> documentManager.commitAllDocuments(), () -> UsefulTestCase.assertEmpty(documentManager.getUncommittedDocuments()), () -> UsefulTestCase.assertEmpty(FileDocumentManager.getInstance().getUnsavedDocuments()) ).run(); }); } catch (Throwable e) { if (failed) { LOG.info("Exceptions while restoring state", e); } else { throw e; } } }