1
0
mirror of https://github.com/chylex/IntelliJ-AceJump.git synced 2025-05-07 08:34:03 +02:00

try @YannCebron's solution to

This commit is contained in:
breandan 2023-07-26 21:49:42 -10:00
parent 56b1dfa9a9
commit 2ffcc2c57a
3 changed files with 8 additions and 6 deletions
build.gradle.kts
gradle/wrapper
src/main/kotlin/org/acejump/action

View File

@ -3,9 +3,9 @@ import org.jetbrains.changelog.date
plugins {
idea apply true
kotlin("jvm") version "1.9.0-Beta"
id("org.jetbrains.intellij") version "1.14.1"
id("org.jetbrains.changelog") version "2.1.0"
kotlin("jvm") version "1.9.0"
id("org.jetbrains.intellij") version "1.15.0"
id("org.jetbrains.changelog") version "2.1.2"
id("com.github.ben-manes.versions") version "0.47.0"
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-rc-2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -3,6 +3,8 @@ package org.acejump.action
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys.EDITOR
import com.intellij.openapi.actionSystem.PlatformDataKeys.LAST_ACTIVE_FILE_EDITOR
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.TextEditor
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
@ -33,11 +35,11 @@ sealed class AceAction: DumbAwareAction() {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
final override fun update(action: AnActionEvent) {
action.presentation.isEnabled = action.getData(EDITOR) != null
action.presentation.isEnabled = (action.getData(EDITOR) ?: action.getData(LAST_ACTIVE_FILE_EDITOR)) != null
}
final override fun actionPerformed(e: AnActionEvent) {
val editor = e.getData(EDITOR) ?: return
val editor = e.getData(EDITOR) ?: e.getData(LAST_ACTIVE_FILE_EDITOR) as? Editor ?: return
val project = e.project
if (project != null) {