Skip to content

Commit fc379dc

Browse files
committed
refactor(ui): improve layout and styling in AutoDevPlanerToolWindow #331
- Replace direct `add(planSketch)` with a resizable panel layout using `panel` DSL. - Remove unnecessary vertical struts in `PlanSketch`. - Set background color for `TaskPanel` to match theme.
1 parent c35028e commit fc379dc

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/AutoDevPlanerToolWindowFactory.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import com.intellij.openapi.wm.ToolWindow
1414
import com.intellij.openapi.wm.ToolWindowFactory
1515
import com.intellij.openapi.wm.ToolWindowManager
1616
import com.intellij.openapi.wm.ex.ToolWindowManagerListener
17+
import com.intellij.ui.dsl.builder.panel
18+
import com.intellij.util.ui.JBUI
19+
import java.awt.BorderLayout
1720
import java.util.concurrent.atomic.AtomicBoolean
1821

1922
class AutoDevPlanerToolWindowFactory : ToolWindowFactory, ToolWindowManagerListener, DumbAware {
@@ -53,7 +56,15 @@ class AutoDevPlanerTooWindow(val project: Project) : SimpleToolWindowPanel(true,
5356
var planSketch: PlanSketch = PlanSketch(project, "", mutableListOf(), true)
5457

5558
init {
56-
add(planSketch)
59+
val planPanel = panel {
60+
row {
61+
cell(planSketch).resizableColumn()
62+
}
63+
}.apply {
64+
border = JBUI.Borders.empty(8)
65+
}
66+
67+
add(planPanel, BorderLayout.CENTER)
5768

5869
connection.subscribe(PlanUpdateListener.TOPIC, object : PlanUpdateListener {
5970
override fun onPlanUpdate(items: MutableList<AgentTaskEntry>) {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ class PlanController(
3434
}
3535

3636
contentPanel.add(sectionPanel)
37-
38-
if (index < agentTaskItems.size - 1) {
39-
contentPanel.add(Box.createVerticalStrut(8))
40-
}
4137
}
4238

4339
contentPanel.revalidate()

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ class TaskPanel(
2727
private val task: AgentPlanStep,
2828
private val onStatusChange: () -> Unit
2929
) : JBPanel<JBPanel<*>>(FlowLayout(FlowLayout.LEFT, 2, 0)) {
30-
3130
private val taskLabel: JLabel
3231

3332
init {
34-
border = JBUI.Borders.empty(1, 16, 1, 0)
33+
border = JBUI.Borders.empty(4, 16, 4, 0)
3534
taskLabel = createStyledTaskLabel()
3635

3736
val statusIcon = createStatusIcon()
@@ -42,6 +41,8 @@ class TaskPanel(
4241
}
4342

4443
add(taskLabel)
44+
45+
background = JBUI.CurrentTheme.ToolWindow.background()
4546
setupContextMenu()
4647
}
4748

0 commit comments

Comments
 (0)