EA-1047558 [extract method]: revert editor state inside write action always

GitOrigin-RevId: f6ca59b7c1ee5a60fe42a2b14925e37d730d601c
This commit is contained in:
Alexandr Suhinin
2024-02-01 10:12:04 +02:00
committed by intellij-monorepo-bot
parent 40f60bd16e
commit b7ca72a251

View File

@@ -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<Throwable> {
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<Throwable> {
PostprocessReformattingAspect.getInstance(project).disablePostprocessFormattingInside(::revertState)
}
}
private fun revertState() {