Skip to content

Commit

Permalink
try @YannCebron's solution to #415, pt. II
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Jul 27, 2023
1 parent 2ffcc2c commit 3c89cd0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/kotlin/org/acejump/action/AceAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ sealed class AceAction: DumbAwareAction() {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT

final override fun update(action: AnActionEvent) {
action.presentation.isEnabled = (action.getData(EDITOR) ?: action.getData(LAST_ACTIVE_FILE_EDITOR)) != null
action.presentation.isEnabled =
(action.getData(EDITOR) ?: (action.getData(LAST_ACTIVE_FILE_EDITOR) as? TextEditor)?.editor) != null
}

final override fun actionPerformed(e: AnActionEvent) {
val editor = e.getData(EDITOR) ?: e.getData(LAST_ACTIVE_FILE_EDITOR) as? Editor ?: return
val editor = e.getData(EDITOR) ?: (e.getData(LAST_ACTIVE_FILE_EDITOR) as? TextEditor)?.editor ?: return
val project = e.project

if (project != null) {
Expand Down

0 comments on commit 3c89cd0

Please sign in to comment.