Skip to content

Commit 5b1be1a

Browse files
committed
feat(ui): add execute task button to ThoughtPlanSketchProvider #331
- Added an execute task button with an action listener to send task steps to the sketch tool window. - Updated the status icon for IN_PROGRESS tasks to use AllIcons.Toolwindows.ToolWindowBuild. - Minor text adjustment in AutoDevBundle_en.properties.
1 parent 68e891d commit 5b1be1a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/sketch/ui/ThoughtPlanSketchProvider.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ class PlanSketch(
112112
border = JBUI.Borders.empty()
113113
}
114114

115+
val executeTaskButton = JButton(AllIcons.Actions.Execute).apply {
116+
border = BorderFactory.createEmptyBorder()
117+
isOpaque = true
118+
preferredSize = Dimension(24, 24)
119+
toolTipText = "Execute Task"
120+
121+
addActionListener {
122+
AutoDevToolWindowFactory.sendToSketchToolWindow(project, ChatActionType.SKETCH) { ui, _ ->
123+
val allSteps = planItem.steps.joinToString("\n") { it.step }
124+
ui.sendInput(AutoDevBundle.message("sketch.plan.finish.task") + allSteps)
125+
}
126+
}
127+
}
128+
129+
titlePanel.add(executeTaskButton)
130+
115131
// Check if all tasks in the section are completed
116132
updateSectionCompletionStatus(planItem)
117133

@@ -146,7 +162,7 @@ class PlanSketch(
146162
val statusIcon = when (task.status) {
147163
TaskStatus.COMPLETED -> JLabel(AllIcons.Actions.Checked)
148164
TaskStatus.FAILED -> JLabel(AllIcons.General.Error)
149-
TaskStatus.IN_PROGRESS -> JLabel(AllIcons.Actions.Execute)
165+
TaskStatus.IN_PROGRESS -> JLabel(AllIcons.Toolwindows.ToolWindowBuild)
150166
TaskStatus.TODO -> JBCheckBox().apply {
151167
isSelected = task.completed
152168
addActionListener {

core/src/main/resources/messages/AutoDevBundle_en.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,4 @@ autodev.run.action=Run this file
226226
#llm.error.url.scheme=请配置好您的模型,参考文档:https://ide.unitmesh.cc/quick-start
227227
llm.error.url.scheme=Please, Please, Please configure your model, refer to the document: https://ide.unitmesh.cc/quick-start
228228
counit.mcp.services.placeholder=MCP Servers
229-
sketch.plan.finish.task=Please help me finish task:
229+
sketch.plan.finish.task=Please help me finish task:

0 commit comments

Comments
 (0)