Skip to content

Commit

Permalink
getActionUpdateThread() = EDT (issue #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkandalov committed Sep 26, 2024
1 parent 82524d0 commit 89e0cc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/activitytracker/PluginUI.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package activitytracker

import activitytracker.Plugin.Companion.pluginId
import activitytracker.EventAnalyzer.Result.*
import activitytracker.Plugin.Companion.pluginId
import activitytracker.liveplugin.*
import com.intellij.CommonBundle
import com.intellij.ide.BrowserUtil
import com.intellij.ide.actions.RevealFileAction
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.actionSystem.ActionUpdateThread.EDT
import com.intellij.openapi.actionSystem.ex.CheckboxAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.Extensions
Expand Down Expand Up @@ -104,29 +105,35 @@ class PluginUI(
private fun createActionGroup(): DefaultActionGroup {
val toggleTracking = object: AnAction(), DumbAware {
override fun actionPerformed(event: AnActionEvent) = plugin.toggleTracking()
override fun getActionUpdateThread() = EDT
override fun update(event: AnActionEvent) {
event.presentation.text = if (state.isTracking) "Stop Tracking" else "Start Tracking"
}
}
val togglePollIdeState = object: CheckboxAction("Poll IDE state") {
override fun isSelected(event: AnActionEvent) = state.pollIdeState
override fun setSelected(event: AnActionEvent, value: Boolean) = plugin.enablePollIdeState(value)
override fun getActionUpdateThread() = EDT
}
val toggleTrackActions = object: CheckboxAction("Track IDE actions") {
override fun isSelected(event: AnActionEvent) = state.trackIdeActions
override fun setSelected(event: AnActionEvent, value: Boolean) = plugin.enableTrackIdeActions(value)
override fun getActionUpdateThread() = EDT
}
val toggleTrackKeyboard = object: CheckboxAction("Track keyboard") {
override fun isSelected(event: AnActionEvent) = state.trackKeyboard
override fun setSelected(event: AnActionEvent, value: Boolean) = plugin.enableTrackKeyboard(value)
override fun getActionUpdateThread() = EDT
}
val trackKeyboardReleased = object: CheckboxAction("Track keyboard(Released)") {
override fun isSelected(event: AnActionEvent) = state.trackKeyboardReleased
override fun setSelected(event: AnActionEvent, value: Boolean) = plugin.enableTrackKeyboardReleased(value)
override fun getActionUpdateThread() = EDT
}
val toggleTrackMouse = object: CheckboxAction("Track mouse") {
override fun isSelected(event: AnActionEvent) = state.trackMouse
override fun setSelected(event: AnActionEvent, value: Boolean) = plugin.enableTrackMouse(value)
override fun getActionUpdateThread() = EDT
}
val openLogInIde = object: AnAction("Open in IDE"), DumbAware {
override fun actionPerformed(event: AnActionEvent) = plugin.openTrackingLogFile(event.project)
Expand Down

0 comments on commit 89e0cc5

Please sign in to comment.