[rdct] IJPL-196175 IJPL-202195: Use WriteAction for file opening if in the modal progress

If the file is opened on EDT under the modal progress, the race could happen between modal progress and `blockingWaitForCompositeFileOpen`:
1. `blockingWaitForCompositeFileOpen` starts with already showing modal progress dialog
2. The pumping inside the function wants to pump the modal dialog and check after it if the initialization job is done
3. The modal dialog waits until all its subroutines (including one that pumps EDT) are finished, thus the EDT will never be pumped.

This bug is similar to the IDEA-319932, where navigation was done under the write action. However, in this case there's no write action, but just Dialog's UI. The temporary fix to this problem is to open the file under write action if there's any modality

GitOrigin-RevId: d9b61bfdefc1dbf51deca146a52160049748da8e
This commit is contained in:
Sergei Kharitontcev-Beglov
2025-09-18 15:14:44 +00:00
committed by intellij-monorepo-bot
parent 7a09ce2984
commit 837bf09c88
@@ -115,7 +115,6 @@ import java.util.concurrent.atomic.LongAdder
import javax.swing.JComponent
import javax.swing.JTabbedPane
import javax.swing.KeyStroke
import kotlin.math.max
import kotlin.time.Duration.Companion.milliseconds
private val LOG = logger<FileEditorManagerImpl>()
@@ -2506,12 +2505,13 @@ fun blockingWaitForCompositeFileOpen(composite: EditorComposite) {
job.invokeOnCompletion {
EventQueue.invokeLater(EmptyRunnable.getInstance())
}
IdeEventQueue.getInstance().pumpEventsForHierarchy {
job.isCompleted
}
job.join()
}
} finally {
}
finally {
cleanup()
}
}