don't use invokeLater

GitOrigin-RevId: e100c451fc949c958bb500306146c8a2c938aedd
This commit is contained in:
Vladimir Krivosheev
2023-05-04 09:45:19 +02:00
committed by intellij-monorepo-bot
parent 1142925787
commit 8ef0fe70e6

View File

@@ -29,6 +29,7 @@ import com.intellij.openapi.client.ClientKind
import com.intellij.openapi.client.ClientSessionsManager import com.intellij.openapi.client.ClientSessionsManager
import com.intellij.openapi.command.CommandProcessor import com.intellij.openapi.command.CommandProcessor
import com.intellij.openapi.components.* import com.intellij.openapi.components.*
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.diagnostic.getOrLogException import com.intellij.openapi.diagnostic.getOrLogException
import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.diagnostic.runAndLogException import com.intellij.openapi.diagnostic.runAndLogException
@@ -119,6 +120,8 @@ import javax.swing.JTabbedPane
import javax.swing.KeyStroke import javax.swing.KeyStroke
import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.milliseconds
private val LOG = logger<FileEditorManagerImpl>()
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
@State(name = "FileEditorManager", storages = [Storage(StoragePathMacros.PRODUCT_WORKSPACE_FILE)], getStateRequiresEdt = true) @State(name = "FileEditorManager", storages = [Storage(StoragePathMacros.PRODUCT_WORKSPACE_FILE)], getStateRequiresEdt = true)
open class FileEditorManagerImpl( open class FileEditorManagerImpl(
@@ -311,8 +314,6 @@ open class FileEditorManagerImpl(
} }
companion object { companion object {
private val LOG = logger<FileEditorManagerImpl>()
@JvmField @JvmField
protected val DUMB_AWARE = Key.create<Boolean>("DUMB_AWARE") protected val DUMB_AWARE = Key.create<Boolean>("DUMB_AWARE")
@@ -339,8 +340,10 @@ open class FileEditorManagerImpl(
/** /**
* Works on [FileEditor] objects, allows forcing opening other editor tabs in the main window. * Works on [FileEditor] objects, allows forcing opening other editor tabs in the main window.
* When determining a proper place to open a new editor tab, the currently selected file editor is checked * When determining a proper place to open a new editor tab, the currently selected file editor is checked
* whether is has this key set to TRUE. If that's the case, and the selected editor is a singleton in a split view, * whether it has this key set to TRUE.
* the new editor tab is opened in the sibling of that split window. If the singleton editor is not in a split view, * If that's the case, and the selected editor is a singleton in a split view,
* the new editor tab is opened in the sibling of that split window.
* If the singleton editor is not in a split view,
* but in a separate detached window, then the new editors will be opened in the main window splitters. * but in a separate detached window, then the new editors will be opened in the main window splitters.
*/ */
@JvmField @JvmField
@@ -1865,12 +1868,10 @@ open class FileEditorManagerImpl(
override fun fileStatusesChanged() { override fun fileStatusesChanged() {
LOG.debug("FileEditorManagerImpl.MyFileStatusListener.fileStatusesChanged()") LOG.debug("FileEditorManagerImpl.MyFileStatusListener.fileStatusesChanged()")
for (file in openedFiles.asReversed()) { for (file in openedFiles.asReversed()) {
ApplicationManager.getApplication().invokeLater({ coroutineScope.launch(Dispatchers.EDT) {
if (LOG.isDebugEnabled) { LOG.debug { "updating file status in tab for ${file.path}" }
LOG.debug("updating file status in tab for " + file.path) updateFileStatus(file)
} }
updateFileStatus(file)
}, ModalityState.NON_MODAL, project.disposed)
} }
} }