@@ -7,6 +7,10 @@ import cc.unitmesh.devti.gui.chat.message.ChatActionType
7
7
import cc.unitmesh.devti.observer.plan.AgentPlanStep
8
8
import cc.unitmesh.devti.observer.plan.TaskStatus
9
9
import com.intellij.ide.ui.UISettings
10
+ import com.intellij.openapi.actionSystem.AnAction
11
+ import com.intellij.openapi.actionSystem.AnActionEvent
12
+ import com.intellij.openapi.actionSystem.Presentation
13
+ import com.intellij.openapi.actionSystem.impl.ActionButton
10
14
import com.intellij.openapi.editor.colors.EditorColorsManager
11
15
import com.intellij.openapi.fileEditor.FileEditorManager
12
16
import com.intellij.openapi.project.Project
@@ -86,7 +90,6 @@ class TaskStepPanel(
86
90
font = Font (editorFontName, Font .PLAIN , editorFontSize)
87
91
foreground = UIUtil .getLabelForeground()
88
92
89
- // Handle links
90
93
addMouseListener(object : MouseAdapter () {
91
94
override fun mouseClicked (e : MouseEvent ) {
92
95
val offset = viewToModel2D(e.point)
@@ -132,19 +135,24 @@ class TaskStepPanel(
132
135
}
133
136
}
134
137
135
- private fun createExecuteButton (): JButton {
136
- return JButton (AutoDevIcons .Run ).apply {
137
- border = BorderFactory .createEmptyBorder()
138
- preferredSize = Dimension (20 , 20 )
139
- toolTipText = " Execute"
140
- background = JBUI .CurrentTheme .ToolWindow .background()
141
-
142
- addActionListener {
138
+ private fun createExecuteButton (): JComponent {
139
+ val executeAction = object : AnAction (AutoDevIcons .Run ) {
140
+ override fun actionPerformed (e : AnActionEvent ) {
143
141
AutoDevToolWindowFactory .Companion .sendToSketchToolWindow(project, ChatActionType .SKETCH ) { ui, _ ->
144
142
ui.sendInput(AutoDevBundle .message(" sketch.plan.finish.task" ) + task.step)
145
143
}
146
144
}
147
145
}
146
+
147
+ val presentation = Presentation ().apply {
148
+ icon = AutoDevIcons .Run
149
+ text = " "
150
+ description = AutoDevBundle .message(" sketch.plan.execute.tooltip" , " Execute" )
151
+ }
152
+
153
+ return ActionButton (executeAction, presentation, " TaskStepPanelExecuteAction" , Dimension (22 , 22 )).apply {
154
+ background = JBUI .CurrentTheme .ToolWindow .background()
155
+ }
148
156
}
149
157
150
158
private fun updateTaskLabel () {
@@ -227,3 +235,4 @@ class TaskStepPanel(
227
235
taskLabel.componentPopupMenu = taskPopupMenu
228
236
}
229
237
}
238
+
0 commit comments