void () { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { PlatformTestUtil.startPerformanceTest("xml formatter", 6800, createTestRunnable()).useLegacyScaling().assertTiming(); highlight(); long start = System.currentTimeMillis(); final UndoManager undoManager = UndoManager.getInstance(getProject()); final FileEditor selectedEditor = editorManager.getSelectedEditor(myFile.getVirtualFile()); assertTrue(undoManager.isUndoAvailable(selectedEditor)); undoManager.undo(selectedEditor); long end = System.currentTimeMillis(); PlatformTestUtil.assertTiming("Fix xml formatter undo performance problem", 3400, end - start); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); highlight(); start = System.currentTimeMillis(); undoManager.redo(selectedEditor); end = System.currentTimeMillis(); PlatformTestUtil.assertTiming("Fix xml formatter redo performance problem", 3400, end - start); } finally { UIUtil.dispatchAllInvocationEvents(); final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); if (selectedFiles.length > 0) editorManager.closeFile(selectedFiles[0]); } }