Skip to content

Commit

Permalink
return f1 action back
Browse files Browse the repository at this point in the history
  • Loading branch information
reymondzzzz committed Jul 4, 2024
1 parent b2bd552 commit 4e04e85
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,12 @@ class RefactAIToolboxPaneFactory : ToolWindowFactory {
val tw = ToolWindowManager.getInstance(getLastUsedProject()).getToolWindow("Refact")
return tw?.contentManager?.findContent("Chat")?.getUserData(panesKey)
}
fun focusChat() {
val tw = ToolWindowManager.getInstance(getLastUsedProject()).getToolWindow("Refact")
val content = tw?.contentManager?.findContent("Chat") ?: return
tw.contentManager.setSelectedContent(content, true)
val panes = content.getUserData(panesKey)
panes?.requestFocus()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.smallcloud.refactai.panes.sharedchat

import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.wm.ToolWindowManager
import com.smallcloud.refactai.Resources
import com.smallcloud.refactai.panes.RefactAIToolboxPaneFactory
import com.smallcloud.refactai.utils.getLastUsedProject

class ChatPaneInvokeAction: AnAction(Resources.Icons.LOGO_RED_16x16) {
override fun actionPerformed(e: AnActionEvent) {
val chat = ToolWindowManager.getInstance(getLastUsedProject()).getToolWindow("Refact")
chat?.activate{
RefactAIToolboxPaneFactory.focusChat()
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ integrated into a single package that follows your privacy settings.</p>
<!-- For display shortcut on the pane, action must be with mask "Activate${id.filterNot { it.isWhitespace() }}ToolWindow"-->
<action id="ActivateRefactChatToolWindow"
text="Open Refact Toolbox"
class="com.smallcloud.refactai.panes.gptchat.ChatGPTPaneInvokeAction">
class="com.smallcloud.refactai.panes.sharedchat.ChatPaneInvokeAction">
<keyboard-shortcut first-keystroke="F1" keymap="$default"/>
</action>

Expand Down

0 comments on commit 4e04e85

Please sign in to comment.