mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Revert "[threading] IJPL-211526: Remove Dispatchers.UiWithModelAccess during UI initialization"
This commit leads to degradation in RUST-19396 and IJPL-225525 This reverts commit 3e00bf95814704db977ca58769f13f0f222455d1. GitOrigin-RevId: 52f0f61d3b37af9bed9aecddad969cb753a94775
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4b1a595205
commit
7f800b0fb6
+1
-1
@@ -62,7 +62,7 @@ fun initMacApplication(mainScope: CoroutineScope) {
|
||||
val desktop = Desktop.getDesktop()
|
||||
desktop.setAboutHandler {
|
||||
submit("About", mainScope) { ideFocusManager ->
|
||||
val project = withContext(Dispatchers.EDT) {
|
||||
val project = withContext(Dispatchers.UiWithModelAccess) {
|
||||
val project = (ideFocusManager.lastFocusedIdeWindow as? IdeFrame)?.project
|
||||
AboutAction.perform(project)
|
||||
project
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide
|
||||
|
||||
import com.intellij.openapi.application.*
|
||||
@@ -68,7 +68,7 @@ object ApplicationActivationStateManager {
|
||||
if (ideFrame != null) {
|
||||
// getIdeFrameFromWindow returns something from a UI tree, so, if not null, it must be Window
|
||||
val publisher = app.getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC)
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
publisher.delayedApplicationDeactivated(ideFrame as Window)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.ide.lightEdit.project.LightEditFileEditorManagerImpl
|
||||
import com.intellij.ide.lightEdit.statusBar.*
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.UiWithModelAccess
|
||||
import com.intellij.openapi.components.ComponentManagerEx
|
||||
import com.intellij.openapi.components.serviceAsync
|
||||
import com.intellij.openapi.extensions.LoadingOrder
|
||||
@@ -45,7 +45,7 @@ import javax.swing.JFrame
|
||||
@RequiresEdt
|
||||
internal fun allocateLightEditFrame(project: Project, frameInfo: FrameInfo?): LightEditFrameWrapper {
|
||||
return runWithModalProgressBlocking(ModalTaskOwner.guess(), "") {
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
val wrapper = allocateLightEditFrame(project) { frame ->
|
||||
LightEditFrameWrapper(project = project, frame = frame ?: createIdeFrame(frameInfo ?: FrameInfo()))
|
||||
} as LightEditFrameWrapper
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.ui.laf
|
||||
|
||||
import com.intellij.jna.JnaLoader
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.asContextElement
|
||||
import com.intellij.openapi.application.*
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
@@ -58,7 +55,7 @@ private abstract class AsyncDetector : SystemDarkThemeDetector() {
|
||||
override fun check(parameter: Boolean?) {
|
||||
service<CoreUiCoroutineScopeHolder>().coroutineScope.launch {
|
||||
val isDark = isDark()
|
||||
withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) {
|
||||
withContext(Dispatchers.UiWithModelAccess + ModalityState.any().asContextElement()) {
|
||||
syncFunction.accept(isDark, parameter)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ internal class IdeProjectFrameAllocator(
|
||||
launch {
|
||||
val fileEditorManager = project.serviceAsync<FileEditorManager>() as FileEditorManagerImpl
|
||||
fileEditorManager.initJob.join()
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
frameHelper.toolWindowPane.setDocumentComponent(fileEditorManager.mainSplitters)
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ internal class IdeProjectFrameAllocator(
|
||||
else {
|
||||
val frameHelper = IdeProjectFrameHelper(createIdeFrame(frameInfo), loadingState = loadingState)
|
||||
// must be after preInit (frame decorator is required to set a full-screen mode)
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
frameHelper.frame.isVisible = true
|
||||
}
|
||||
completeFrameAndCloseOnCancel(frameHelper) {
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ private class ToolbarCreator(
|
||||
|
||||
private fun startNewJob(): Deferred<JComponent> {
|
||||
val newJob = cs.async(
|
||||
Dispatchers.EDT +
|
||||
Dispatchers.UiWithModelAccess +
|
||||
ModalityState.any().asContextElement() +
|
||||
CoroutineName("Lazy MainToolbar computation")
|
||||
) {
|
||||
|
||||
@@ -18,8 +18,8 @@ import com.intellij.openapi.actionSystem.UiDataProvider
|
||||
import com.intellij.openapi.actionSystem.impl.MouseGestureManager
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.UiWithModelAccess
|
||||
import com.intellij.openapi.application.impl.InternalUICustomization
|
||||
import com.intellij.openapi.application.impl.LaterInvocator
|
||||
import com.intellij.openapi.components.service
|
||||
@@ -349,7 +349,7 @@ abstract class ProjectFrameHelper internal constructor(
|
||||
|
||||
suspend fun updateTitle(title: String, project: Project) {
|
||||
val titleInfoProviders = getTitleInfoProviders()
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
this@ProjectFrameHelper.title = title
|
||||
updateTitle(project = project, titleInfoProviders = titleInfoProviders)
|
||||
}
|
||||
@@ -435,7 +435,7 @@ abstract class ProjectFrameHelper internal constructor(
|
||||
|
||||
this.project = project
|
||||
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
applyInitBounds()
|
||||
|
||||
if (statusBar == null) {
|
||||
|
||||
@@ -1621,7 +1621,7 @@ open class ToolWindowManagerImpl @NonInjectable @TestOnly internal constructor(
|
||||
|
||||
override fun invokeLater(runnable: Runnable) {
|
||||
if (!toolWindowSetInitializer.addToPendingTasksIfNotInitialized(runnable)) {
|
||||
coroutineScope.launch(Dispatchers.EDT + ModalityState.nonModal().asContextElement()) {
|
||||
coroutineScope.launch(Dispatchers.UiWithModelAccess + ModalityState.nonModal().asContextElement()) {
|
||||
runnable.run()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.actionSystem.toolbarLayout.CompressingLayoutStrategy
|
||||
import com.intellij.openapi.actionSystem.toolbarLayout.ToolbarLayoutStrategy
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.UiWithModelAccess
|
||||
import com.intellij.openapi.application.impl.BorderPainterHolder
|
||||
import com.intellij.openapi.application.impl.InternalUICustomization
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
@@ -208,7 +209,7 @@ class MainToolbar(
|
||||
|
||||
for (widget in widgets) {
|
||||
// separate EDT action - avoid long-running update
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
widget.first.updateActions()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ open class IdeStatusBarImpl @Internal constructor(
|
||||
* @param widget widget to add
|
||||
*/
|
||||
internal suspend fun addWidgetToLeft(widget: StatusBarWidget) {
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
addWidget(widget, Position.LEFT, LoadingOrder.ANY)
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ open class IdeStatusBarImpl @Internal constructor(
|
||||
// Create components in parallel (performance optimization)
|
||||
val beans: List<WidgetBean> = span("status bar widget creating") {
|
||||
widgets.map { (widget, anchor) ->
|
||||
val component = span(widget.ID(), Dispatchers.EDT + anyModality) {
|
||||
val component = span(widget.ID(), Dispatchers.UiWithModelAccess + anyModality) {
|
||||
val c = wrap(widget)
|
||||
if (c is StatusBarWidgetWrapper) {
|
||||
c.beforeUpdate()
|
||||
@@ -341,7 +341,7 @@ open class IdeStatusBarImpl @Internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
withContext(Dispatchers.EDT + anyModality + CoroutineName("status bar widget adding")) {
|
||||
withContext(Dispatchers.UiWithModelAccess + anyModality + CoroutineName("status bar widget adding")) {
|
||||
// Add all to self
|
||||
for (bean in beans) {
|
||||
addWidgetToSelf(bean, parentDisposable)
|
||||
@@ -358,14 +358,14 @@ open class IdeStatusBarImpl @Internal constructor(
|
||||
|
||||
// Fire events
|
||||
if (listeners.hasListeners()) {
|
||||
withContext(Dispatchers.EDT + anyModality) {
|
||||
withContext(Dispatchers.UiWithModelAccess + anyModality) {
|
||||
for (bean in beans) {
|
||||
fireWidgetAdded(bean.widget, bean.anchor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
PopupHandler.installPopupMenu(this@IdeStatusBarImpl, StatusBarWidgetsActionGroup.GROUP_ID, ActionPlaces.STATUS_BAR_PLACE)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ui.mac
|
||||
|
||||
import com.intellij.ide.DataManager
|
||||
@@ -7,7 +7,7 @@ import com.intellij.ide.SystemDock
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.UiWithModelAccess
|
||||
import com.intellij.openapi.components.serviceAsync
|
||||
import com.intellij.openapi.diagnostic.getOrHandleException
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
@@ -19,7 +19,7 @@ import java.awt.*
|
||||
|
||||
internal suspend fun createMacDelegate(): SystemDock? {
|
||||
// todo get rid of UI dispatcher here
|
||||
return withContext(Dispatchers.EDT) {
|
||||
return withContext(Dispatchers.UiWithModelAccess) {
|
||||
val dockMenu = PopupMenu("DockMenu")
|
||||
|
||||
runCatching {
|
||||
@@ -53,7 +53,7 @@ private class MacDockDelegate(private val recentProjectsMenu: Menu) : SystemDock
|
||||
override suspend fun updateRecentProjectsMenu() {
|
||||
val projectListActionProvider = serviceAsync<RecentProjectListActionProvider>()
|
||||
// todo get rid of UI dispatcher here
|
||||
withContext(Dispatchers.EDT) {
|
||||
withContext(Dispatchers.UiWithModelAccess) {
|
||||
recentProjectsMenu.removeAll()
|
||||
for (action in projectListActionProvider.getActionsWithoutGroups()) {
|
||||
if (action !is ProjectToolbarWidgetPresentable) {
|
||||
|
||||
Reference in New Issue
Block a user