deprecate UpdateInBackground: cleanup 3

GitOrigin-RevId: 09cb45af326017722587efc2e3f7fd73680f4f67
This commit is contained in:
Gregory.Shrago
2022-06-01 20:14:18 +03:00
committed by intellij-monorepo-bot
parent 2373ee73ff
commit b86bfa4112
17 changed files with 83 additions and 34 deletions

View File

@@ -108,9 +108,11 @@ internal class RunToolbarWidget(val project: Project) : JBPanel<RunToolbarWidget
}
}
internal class RunWithDropDownAction : AnAction(AllIcons.Actions.Execute), CustomComponentAction, DumbAware, UpdateInBackground {
internal class RunWithDropDownAction : AnAction(AllIcons.Actions.Execute), CustomComponentAction, DumbAware {
private val spinningIcon = SpinningProgressIcon()
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun actionPerformed(e: AnActionEvent) {
if (!e.presentation.isEnabled) return
val conf = e.presentation.getClientProperty(CONF)
@@ -310,7 +312,9 @@ internal class RunWithDropDownAction : AnAction(AllIcons.Actions.Execute), Custo
}
}
class StopWithDropDownAction : AnAction(), CustomComponentAction, DumbAware, UpdateInBackground {
class StopWithDropDownAction : AnAction(), CustomComponentAction, DumbAware {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun actionPerformed(e: AnActionEvent) {
ExecutionManagerImpl.getInstance(e.project ?: return)

View File

@@ -5,11 +5,11 @@ import com.intellij.codeInsight.daemon.impl.ShowIntentionsPass
import com.intellij.codeInsight.intention.impl.CachedIntentions
import com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching
import com.intellij.codeInsight.intention.impl.IntentionListStep
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys.PSI_FILE
import com.intellij.openapi.actionSystem.PlatformCoreDataKeys.SELECTED_ITEM
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.actionSystem.impl.ActionButton
import com.intellij.openapi.application.ApplicationManager.getApplication
import com.intellij.openapi.application.ModalityState
@@ -26,7 +26,9 @@ import com.intellij.ui.awt.RelativePoint
import com.intellij.util.ui.UIUtil.isAncestor
import java.awt.event.MouseEvent
internal class ShowQuickFixesAction : AnAction(), UpdateInBackground {
internal class ShowQuickFixesAction : AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(event: AnActionEvent) {
val node = event.getData(SELECTED_ITEM) as? ProblemNode

View File

@@ -19,7 +19,6 @@ open class ShowQuickDocInfoAction : AnAction(),
ActionToIgnore,
DumbAware,
PopupAction,
UpdateInBackground,
PerformWithDocumentsCommitted {
init {
@@ -28,6 +27,8 @@ open class ShowQuickDocInfoAction : AnAction(),
setInjectedContext(true)
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
if (isDocumentationV2Enabled()) {
e.presentation.isEnabled = e.dataContext.getData(DOCUMENTATION_TARGETS)?.isNotEmpty() ?: false

View File

@@ -18,10 +18,10 @@ import com.intellij.lang.Language
import com.intellij.notification.Notification
import com.intellij.notification.NotificationListener
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.editor.impl.ImaginaryEditor
@@ -35,12 +35,14 @@ import com.intellij.psi.util.PsiTreeUtil
import java.util.function.Predicate
class ShowSettingsWithAddedPattern : AnAction(), UpdateInBackground {
class ShowSettingsWithAddedPattern : AnAction() {
init {
templatePresentation.description = CodeInsightBundle.message("inlay.hints.show.settings.description")
templatePresentation.text = CodeInsightBundle.message("inlay.hints.show.settings", "_")
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
val file = e.getData(CommonDataKeys.PSI_FILE) ?: return
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
@@ -64,7 +66,10 @@ class ShowSettingsWithAddedPattern : AnAction(), UpdateInBackground {
}
}
class ShowParameterHintsSettings : AnAction(), UpdateInBackground {
class ShowParameterHintsSettings : AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun actionPerformed(e: AnActionEvent) {
showParameterHintsDialog(e) {null}
}
@@ -259,7 +264,9 @@ private fun InlayParameterHintsProvider.hasDisabledOptionHintInfo(element: PsiEl
}
class ToggleInlineHintsAction : AnAction(), UpdateInBackground {
class ToggleInlineHintsAction : AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
if (!InlayParameterHintsExtension.hasAnyExtensions()) {

View File

@@ -20,7 +20,10 @@ import com.intellij.psi.PsiFileSystemItem
import com.intellij.ui.tabs.impl.TabLabel
import java.awt.datatransfer.StringSelection
abstract class CopyPathProvider : AnAction(), UpdateInBackground {
abstract class CopyPathProvider : AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
val dataContext = e.dataContext
val editor = CommonDataKeys.EDITOR.getData(dataContext)

View File

@@ -3,17 +3,19 @@ package com.intellij.lang.documentation.ide.actions
import com.intellij.lang.documentation.DocumentationTarget
import com.intellij.model.Pointer
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.ReadAction
import com.intellij.util.OpenSourceUtil
import com.intellij.util.concurrency.AppExecutorUtil
import java.util.concurrent.Callable
internal class DocumentationEditSourceAction : AnAction(), UpdateInBackground {
internal class DocumentationEditSourceAction : AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
private fun targetPointer(dc: DataContext): Pointer<out DocumentationTarget>? = documentationBrowser(dc)?.targetPointer

View File

@@ -350,9 +350,11 @@ abstract class ToolWindowHeader internal constructor(
return Dimension(size.width, height)
}
private inner class ShowOptionsAction : DumbAwareAction(), UpdateInBackground {
private inner class ShowOptionsAction : DumbAwareAction() {
val myPopupState = PopupState.forPopupMenu()
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = true
}
@@ -377,7 +379,10 @@ abstract class ToolWindowHeader internal constructor(
}
}
private inner class HideAction : DumbAwareAction(), UpdateInBackground {
private inner class HideAction : DumbAwareAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = true
}

View File

@@ -2,9 +2,9 @@
package com.intellij.openapi.vcs.actions
import com.intellij.configurationStore.StoreUtil
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.Presentation
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.NlsActions
@@ -16,9 +16,8 @@ import com.intellij.openapi.vcs.changes.*
import com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog
import com.intellij.util.containers.ContainerUtil.concat
import com.intellij.util.ui.UIUtil.removeMnemonic
import com.intellij.vcs.commit.CommitMode
import com.intellij.vcs.commit.CommitWorkflowHandler
import com.intellij.vcs.commit.CommitModeManager
import com.intellij.vcs.commit.CommitWorkflowHandler
import com.intellij.vcs.commit.removeEllipsisSuffix
import org.jetbrains.annotations.ApiStatus
@@ -31,7 +30,10 @@ private fun getChangesIn(project: Project, roots: Array<FilePath>): Set<Change>
internal fun AnActionEvent.getContextCommitWorkflowHandler(): CommitWorkflowHandler? = getData(COMMIT_WORKFLOW_HANDLER)
abstract class AbstractCommonCheckinAction : AbstractVcsAction(), UpdateInBackground {
abstract class AbstractCommonCheckinAction : AbstractVcsAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(vcsContext: VcsContext, presentation: Presentation) {
val project = vcsContext.project

View File

@@ -25,10 +25,12 @@ open class IgnoreFileActionGroup(private val ignoreFileType: IgnoreFileType) :
message("vcs.add.to.ignore.file.action.group.text", ignoreFileType.ignoreLanguage.filename),
message("vcs.add.to.ignore.file.action.group.description", ignoreFileType.ignoreLanguage.filename),
ignoreFileType.icon
), DumbAware, UpdateInBackground {
), DumbAware {
private var actions: Collection<AnAction> = emptyList()
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
val selectedFiles = getSelectedFiles(e)
val presentation = e.presentation

View File

@@ -7,9 +7,9 @@ import com.intellij.ide.actions.JavaCreateTemplateInPackageAction
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.notification.Notifications
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.ModuleManager
@@ -37,7 +37,10 @@ import org.jetbrains.jps.model.java.JavaResourceRootType
import java.util.function.Consumer
import java.util.function.Predicate
class NewMessageBundleAction : CreateElementActionBase(), UpdateInBackground {
class NewMessageBundleAction : CreateElementActionBase() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun invokeDialog(project: Project, directory: PsiDirectory, elementsConsumer: Consumer<in Array<PsiElement>>) {
val module = ModuleUtilCore.findModuleForPsiElement(directory) ?: return
if (module.name.endsWith(".impl") && ModuleManager.getInstance(project).findModuleByName(module.name.removeSuffix(".impl")) != null) {

View File

@@ -12,9 +12,9 @@ import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.ide.plugins.PluginNode
import com.intellij.ide.plugins.marketplace.MarketplaceRequests
import com.intellij.notification.*
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.PathManager
@@ -64,7 +64,10 @@ internal open class UpdateIdeFromSourcesAction
@JvmOverloads constructor(private val forceShowSettings: Boolean = false)
: AnAction(if (forceShowSettings) DevKitBundle.message("action.UpdateIdeFromSourcesAction.update.show.settings.text")
else DevKitBundle.message("action.UpdateIdeFromSourcesAction.update.text"),
DevKitBundle.message("action.UpdateIdeFromSourcesAction.update.description"), null), DumbAware, UpdateInBackground {
DevKitBundle.message("action.UpdateIdeFromSourcesAction.update.description"), null), DumbAware {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return
if (forceShowSettings || UpdateFromSourcesSettings.getState().showSettings) {

View File

@@ -28,10 +28,11 @@ import java.util.*
import javax.swing.JComponent
//TODO better undo support
class NewThemeAction : AnAction(), UpdateInBackground {
class NewThemeAction : AnAction() {
private val THEME_JSON_TEMPLATE = "ThemeJson.json"
private val THEME_PROVIDER_EP_NAME = UIThemeProvider.EP_NAME.name
override fun getActionUpdateThread() = ActionUpdateThread.BGT
@Suppress("UsePropertyAccessSyntax") // IdeView#getOrChooseDirectory is not a getter
override fun actionPerformed(e: AnActionEvent) {

View File

@@ -1,12 +1,15 @@
// 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.workspaceModel.codegen
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.LangDataKeys
import com.intellij.openapi.actionSystem.UpdateInBackground
class WorkspaceModelGenerationAction: AnAction(), UpdateInBackground {
class WorkspaceModelGenerationAction: AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun actionPerformed(event: AnActionEvent) {
val project = event.project ?: return
val module = event.getData(LangDataKeys.MODULE) ?: return

View File

@@ -2,12 +2,15 @@
package git4idea.index.actions
import com.intellij.ide.actions.NonEmptyActionGroup
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.UpdateInBackground
import git4idea.index.vfs.GitIndexVirtualFile
class GitStageIndexFileMenuGroup : NonEmptyActionGroup(), UpdateInBackground {
class GitStageIndexFileMenuGroup : NonEmptyActionGroup() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(event: AnActionEvent) {
event.presentation.isVisible = childrenCount > 0 &&
event.getData(CommonDataKeys.VIRTUAL_FILE) is GitIndexVirtualFile

View File

@@ -1,9 +1,9 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.api
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.ToggleAction
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.project.DumbAware
@@ -15,7 +15,10 @@ class GHRequestExecutorBreaker {
@Volatile
var isRequestsShouldFail = false
class Action : ToggleAction(actionText), DumbAware, UpdateInBackground {
class Action : ToggleAction(actionText), DumbAware {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun isSelected(e: AnActionEvent) =
service<GHRequestExecutorBreaker>().isRequestsShouldFail

View File

@@ -2,9 +2,9 @@
package org.jetbrains.plugins.groovy.console
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.module.Module
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
@@ -20,7 +20,9 @@ class GrSelectModuleAction(
message("select.module.action.text"),
message("select.module.action.description"),
AllIcons.Nodes.Module
), UpdateInBackground {
) {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
private val consoleService by lazy {
GroovyConsoleStateService.getInstance(project)

View File

@@ -3,10 +3,10 @@ package org.jetbrains.java.decompiler
import com.intellij.ide.highlighter.JavaClassFileType
import com.intellij.ide.util.PsiNavigationSupport
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.UpdateInBackground
import com.intellij.openapi.fileTypes.FileTypeRegistry
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiClass
@@ -15,7 +15,10 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.util.PsiUtilBase
class ShowDecompiledClassAction : AnAction(IdeaDecompilerBundle.message("action.show.decompiled.name")), UpdateInBackground {
class ShowDecompiledClassAction : AnAction(IdeaDecompilerBundle.message("action.show.decompiled.name")) {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
val psiElement = getPsiElement(e)
val visible = psiElement?.containingFile is PsiClassOwner