Skip to content

Commit

Permalink
patch for aws#5076 (aws#5081)
Browse files Browse the repository at this point in the history
* patch for aws#5076

* Update plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/inline/OpenChatInputAction.kt

Co-authored-by: Richard Li <[email protected]>

---------

Co-authored-by: Richard Li <[email protected]>
  • Loading branch information
zixlin7 and rli authored Nov 13, 2024
1 parent 2032a57 commit 7c89b10
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@

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)
// FIX_WHEN_MIN_IS_241: change below to use ConsoleViewImpl.IS_CONSOLE_DOCUMENT
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

0 comments on commit 7c89b10

Please sign in to comment.