Skip to content

Commit f96293b

Browse files
committed
refactor: override getActionUpdateThread in all actions
1 parent 089a567 commit f96293b

File tree

7 files changed

+40
-9
lines changed

7 files changed

+40
-9
lines changed

src/main/kotlin/com/github/lppedd/cc/completion/menu/FilterAction.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.github.lppedd.cc.lookupElement.CommitTokenLookupElement
88
import com.github.lppedd.cc.updateIcons
99
import com.intellij.codeInsight.completion.PlainPrefixMatcher
1010
import com.intellij.codeInsight.lookup.impl.LookupImpl
11+
import com.intellij.openapi.actionSystem.ActionUpdateThread
1112
import com.intellij.openapi.actionSystem.AnAction
1213
import com.intellij.openapi.actionSystem.AnActionEvent
1314
import java.util.*
@@ -69,6 +70,9 @@ internal class FilterAction(
6970
backupItems = emptyList()
7071
}
7172

73+
override fun getActionUpdateThread(): ActionUpdateThread =
74+
ActionUpdateThread.EDT
75+
7276
override fun actionPerformed(event: AnActionEvent) {
7377
if (enhancer.filterSelected(this)) {
7478
filterItems(!isFiltered)

src/main/kotlin/com/github/lppedd/cc/completion/menu/SettingsActions.kt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import com.github.lppedd.cc.configuration.CCConfigService.ProviderFilterType.KEE
1010
import com.github.lppedd.cc.updateIcons
1111
import com.intellij.codeInsight.lookup.impl.LookupImpl
1212
import com.intellij.icons.AllIcons
13-
import com.intellij.openapi.actionSystem.ActionGroup
14-
import com.intellij.openapi.actionSystem.AnAction
15-
import com.intellij.openapi.actionSystem.AnActionEvent
16-
import com.intellij.openapi.actionSystem.Separator
13+
import com.intellij.openapi.actionSystem.*
1714
import com.intellij.openapi.components.service
1815
import com.intellij.openapi.project.DumbAware
1916
import com.intellij.util.ui.UIUtil
@@ -47,10 +44,17 @@ internal class SettingsActions(
4744
Objects.hashCode(lookup)
4845

4946
private inner class CompletionModeChangeAction : AnAction() {
47+
override fun getActionUpdateThread(): ActionUpdateThread =
48+
ActionUpdateThread.EDT
49+
5050
override fun actionPerformed(e: AnActionEvent) {
5151
config.completionType =
52-
if (config.completionType == TEMPLATE) POPUP
53-
else TEMPLATE
52+
if (config.completionType == TEMPLATE) {
53+
POPUP
54+
} else {
55+
TEMPLATE
56+
}
57+
5458
enhancer.settingChanged()
5559
}
5660

@@ -67,10 +71,17 @@ internal class SettingsActions(
6771
}
6872

6973
private inner class FilterModeChangeAction : AnAction() {
74+
override fun getActionUpdateThread(): ActionUpdateThread =
75+
ActionUpdateThread.EDT
76+
7077
override fun actionPerformed(e: AnActionEvent) {
7178
config.providerFilterType =
72-
if (config.providerFilterType == HIDE_SELECTED) KEEP_SELECTED
73-
else HIDE_SELECTED
79+
if (config.providerFilterType == HIDE_SELECTED) {
80+
KEEP_SELECTED
81+
} else {
82+
HIDE_SELECTED
83+
}
84+
7485
enhancer.settingChanged()
7586
}
7687

src/main/kotlin/com/github/lppedd/cc/editor/CommitTabAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ internal class CommitTabAction : TabAction() {
7272
}
7373
}
7474

75-
@Suppress("deprecation")
75+
@Suppress("DEPRECATION")
7676
return super.isEnabled(editor, dataContext)
7777
}
7878

src/main/kotlin/com/github/lppedd/cc/ui/DialogGotoErrorAction.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.lppedd.cc.ui
22

33
import com.github.lppedd.cc.ui.CCDialogWrapper.ValidationNavigable
4+
import com.intellij.openapi.actionSystem.ActionUpdateThread
45
import com.intellij.openapi.actionSystem.AnActionEvent
56
import com.intellij.openapi.project.DumbAwareAction
67
import com.intellij.ui.EditorTextField
@@ -14,6 +15,9 @@ internal abstract class DialogGotoErrorAction : DumbAwareAction() {
1415
isEnabledInModalContext = true
1516
}
1617

18+
override fun getActionUpdateThread(): ActionUpdateThread =
19+
ActionUpdateThread.EDT
20+
1721
override fun update(event: AnActionEvent) {
1822
event.presentation.isEnabledAndVisible = event.getData(ValidationNavigable.DIALOG) != null
1923
}

src/main/kotlin/com/github/lppedd/cc/vcs/ClearLocalMessageHistoryAction.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.lppedd.cc.vcs
22

33
import com.github.lppedd.cc.CCIcons
4+
import com.intellij.openapi.actionSystem.ActionUpdateThread
45
import com.intellij.openapi.actionSystem.AnActionEvent
56
import com.intellij.openapi.components.service
67
import com.intellij.openapi.project.DumbAwareAction
@@ -16,6 +17,9 @@ internal class ClearLocalMessageHistoryAction : DumbAwareAction() {
1617
templatePresentation.icon = CCIcons.General.ClearMessageHistory
1718
}
1819

20+
override fun getActionUpdateThread(): ActionUpdateThread =
21+
ActionUpdateThread.EDT
22+
1923
override fun update(event: AnActionEvent) {
2024
event.presentation.isEnabledAndVisible = false
2125
val project = event.project

src/main/kotlin/com/github/lppedd/cc/vcs/commitbuilder/CommitBuilderAction.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.github.lppedd.cc.CCBundle
44
import com.github.lppedd.cc.CCIcons
55
import com.github.lppedd.cc.moveCaretToOffset
66
import com.github.lppedd.cc.removeSelection
7+
import com.intellij.openapi.actionSystem.ActionUpdateThread
78
import com.intellij.openapi.actionSystem.AnActionEvent
89
import com.intellij.openapi.command.CommandProcessor
910
import com.intellij.openapi.project.DumbAwareAction
@@ -24,6 +25,9 @@ internal class CommitBuilderAction : DumbAwareAction() {
2425
templatePresentation.icon = CCIcons.Logo
2526
}
2627

28+
override fun getActionUpdateThread(): ActionUpdateThread =
29+
ActionUpdateThread.EDT
30+
2731
override fun update(event: AnActionEvent) {
2832
val isVisible = event.project != null && getCommitMessagePanel(event) != null
2933
event.presentation.isEnabledAndVisible = isVisible

src/main/kotlin/com/github/lppedd/cc/whatsnew/WhatsNewAction.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.lppedd.cc.whatsnew
22

33
import com.github.lppedd.cc.CCIcons
4+
import com.intellij.openapi.actionSystem.ActionUpdateThread
45
import com.intellij.openapi.actionSystem.AnActionEvent
56
import com.intellij.openapi.project.DumbAwareAction
67

@@ -15,6 +16,9 @@ internal class WhatsNewAction : DumbAwareAction() {
1516
templatePresentation.icon = CCIcons.Logo
1617
}
1718

19+
override fun getActionUpdateThread(): ActionUpdateThread =
20+
ActionUpdateThread.EDT
21+
1822
override fun actionPerformed(event: AnActionEvent) {
1923
WhatsNewDialog.showForProject(event.project ?: return)
2024
}

0 commit comments

Comments
 (0)