diff --git a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/AutoCorrectAction.kt b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/AutoCorrectAction.kt index de40461..32aab82 100644 --- a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/AutoCorrectAction.kt +++ b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/AutoCorrectAction.kt @@ -21,6 +21,8 @@ class AutoCorrectAction : AnAction(PluginUtils.pluginIcon()) { private val logger = logger() + override fun getActionUpdateThread() = ActionUpdateThread.BGT + override fun update(event: AnActionEvent) { val file: VirtualFile = event.getData(CommonDataKeys.VIRTUAL_FILE) ?: return val project = event.getData(CommonDataKeys.PROJECT) ?: return @@ -69,6 +71,4 @@ class AutoCorrectAction : AnAction(PluginUtils.pluginIcon()) { } } } - - override fun getActionUpdateThread() = ActionUpdateThread.EDT } diff --git a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/EnableBackgroundAnalysisAction.kt b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/EnableBackgroundAnalysisAction.kt index db04450..9f06735 100644 --- a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/EnableBackgroundAnalysisAction.kt +++ b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/EnableBackgroundAnalysisAction.kt @@ -1,5 +1,6 @@ package io.gitlab.arturbosch.detekt.idea.action +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.ToggleAction import com.intellij.openapi.components.service @@ -9,6 +10,8 @@ import io.gitlab.arturbosch.detekt.idea.util.PluginUtils class EnableBackgroundAnalysisAction : ToggleAction(null, null, PluginUtils.pluginIcon()), DumbAware { + override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT + override fun isSelected(e: AnActionEvent): Boolean { val project = e.project ?: return false return project.service().enableDetekt diff --git a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunAnalysisAction.kt b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunAnalysisAction.kt index 4abf4ff..673159b 100644 --- a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunAnalysisAction.kt +++ b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunAnalysisAction.kt @@ -1,5 +1,6 @@ package io.gitlab.arturbosch.detekt.idea.action +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys @@ -19,6 +20,8 @@ import org.jetbrains.kotlin.idea.KotlinLanguage class RunAnalysisAction : AnAction(PluginUtils.pluginIcon()) { + override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT + override fun update(event: AnActionEvent) { val selectedFiles = event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY) ?: return val isDirectoryOrKotlinFile = selectedFiles.any { it.isDirectory || it.extension in KOTLIN_FILE_EXTENSIONS } diff --git a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunDetektMenuGroup.kt b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunDetektMenuGroup.kt index 43cc98a..2e1706d 100644 --- a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunDetektMenuGroup.kt +++ b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunDetektMenuGroup.kt @@ -1,6 +1,7 @@ package io.gitlab.arturbosch.detekt.idea.action import com.intellij.openapi.actionSystem.ActionPlaces +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.DefaultActionGroup import com.intellij.openapi.fileEditor.FileEditorManager @@ -8,6 +9,8 @@ import io.gitlab.arturbosch.detekt.idea.util.PluginUtils class RunDetektMenuGroup : DefaultActionGroup(null, null, PluginUtils.pluginIcon()) { + override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT + override fun update(e: AnActionEvent) { val project = e.project val presentation = e.presentation diff --git a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/util/ProjectUtils.kt b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/util/ProjectUtils.kt index 1f5d7c9..b6acd82 100644 --- a/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/util/ProjectUtils.kt +++ b/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/util/ProjectUtils.kt @@ -2,6 +2,7 @@ package io.gitlab.arturbosch.detekt.idea.util import com.intellij.notification.Notification 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.application.ApplicationManager @@ -66,6 +67,7 @@ fun showNotification(title: String, content: String, project: Project) { ) notification.addAction(object : AnAction(DetektBundle.message("detekt.notifications.actions.openSettings")) { + override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT override fun actionPerformed(e: AnActionEvent) { val dialog = SettingsDialog( project,