Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@

package software.aws.toolkits.jetbrains.services.cwc.inline

import com.intellij.execution.impl.ConsoleViewImpl
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.util.Key

class OpenChatInputAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
val isConsole = editor.document.getUserData(ConsoleViewImpl.IS_CONSOLE_DOCUMENT)
// this is a hack since this key does not exist in 233
// TODO: change below to use ConsoleViewImpl.IS_CONSOLE_DOCUMENT after 233 support is removed
var isConsole: Any? = null
val key: Key<*>? = Key.findKeyByName("IS_CONSOLE_DOCUMENT")
if (key != null) {
isConsole = editor.document.getUserData(key)
}
if (isConsole == true) return
if (!editor.document.isWritable) return
val project = editor.project ?: return
Expand Down
Loading