diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/inplace/EditorState.kt b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/inplace/EditorState.kt index b3fd22747578..ca588b4fbd6d 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/inplace/EditorState.kt +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/inplace/EditorState.kt @@ -17,19 +17,18 @@ class EditorState(val project: Project, val editor: Editor){ private val textToRevert: String = editor.document.text fun revert() { - val undoManager = UndoManager.getInstance(project) - WriteAction.run { - if (undoManager.isUndoOrRedoInProgress) { - ApplicationManager.getApplication().invokeLater { revertWithoutPostprocessing(project) } - } - else { - revertWithoutPostprocessing(project) - } + if (UndoManager.getInstance(project).isUndoOrRedoInProgress) { + ApplicationManager.getApplication().invokeLater { revertWithoutPostprocessing() } + } + else { + revertWithoutPostprocessing() } } - private fun revertWithoutPostprocessing(project: Project) { + private fun revertWithoutPostprocessing() { + WriteAction.run { PostprocessReformattingAspect.getInstance(project).disablePostprocessFormattingInside(::revertState) + } } private fun revertState() {