@@ -40,17 +40,18 @@ class TaskStepPanel(
40
40
private val doc: StyledDocument
41
41
private val linkMap = mutableMapOf<IntRange , String >()
42
42
private var statusLabel: JLabel ? = null
43
+ private val MAX_TEXT_LENGTH = 100 // Maximum characters to display before truncating
43
44
44
45
init {
45
46
layout = BorderLayout ()
46
47
background = JBUI .CurrentTheme .ToolWindow .background()
47
48
border = CompoundBorder (
48
49
BorderFactory .createMatteBorder(0 , 0 , 1 , 0 , JBColor (0xE5E5E5 , 0x323232 )),
49
- JBUI .Borders .empty(6 , 4 )
50
+ JBUI .Borders .empty(3 , 2 ) // Reduced padding for more compact view
50
51
)
51
52
52
- // Left panel for status icon
53
- val leftPanel = JPanel (FlowLayout (FlowLayout .LEFT , 5 , 0 )).apply {
53
+ // Left panel for status icon with reduced spacing
54
+ val leftPanel = JPanel (FlowLayout (FlowLayout .LEFT , 2 , 0 )).apply {
54
55
isOpaque = false
55
56
}
56
57
@@ -67,22 +68,21 @@ class TaskStepPanel(
67
68
add(taskLabel, BorderLayout .CENTER )
68
69
}
69
70
70
- // Right panel for status and action buttons
71
- val rightPanel = JPanel (FlowLayout (FlowLayout .RIGHT , 5 , 0 )).apply {
71
+ val rightPanel = JPanel (FlowLayout (FlowLayout .RIGHT , 2 , 0 )).apply {
72
72
isOpaque = false
73
73
}
74
74
75
75
statusLabel = JLabel (getStatusText(task.status)).apply {
76
76
foreground = getStatusColor(task.status)
77
- font = font.deriveFont(Font .PLAIN , 10f )
78
- border = JBUI .Borders .empty(2 , 5 )
77
+ font = font.deriveFont(Font .PLAIN , 9f )
78
+ border = JBUI .Borders .empty(1 , 3 )
79
79
}
80
80
rightPanel.add(statusLabel)
81
81
82
82
if (task.status == TaskStatus .TODO || task.status == TaskStatus .FAILED ) {
83
83
val executeButton = JButton (AutoDevIcons .Run ).apply {
84
- preferredSize = Dimension (24 , 24 )
85
- margin = JBUI .insets( 0 )
84
+ preferredSize = Dimension (20 , 20 )
85
+ margin = JBUI .emptyInsets( )
86
86
isBorderPainted = false
87
87
isContentAreaFilled = false
88
88
toolTipText = " Execute this step"
@@ -93,8 +93,8 @@ class TaskStepPanel(
93
93
94
94
if (task.status == TaskStatus .FAILED ) {
95
95
val retryButton = JButton (" Retry" ).apply {
96
- margin = JBUI .insets(0 , 3 )
97
- font = font.deriveFont(Font .PLAIN , 10f )
96
+ margin = JBUI .insets(0 , 2 ) // Less margin
97
+ font = font.deriveFont(Font .PLAIN , 9f ) // Smaller font size
98
98
addActionListener { executeTask() }
99
99
}
100
100
rightPanel.add(retryButton)
@@ -105,13 +105,25 @@ class TaskStepPanel(
105
105
add(rightPanel, BorderLayout .EAST )
106
106
107
107
setupContextMenu()
108
+
109
+ // Set preferred size for compact view
110
+ preferredSize = Dimension (preferredSize.width, Math .min(preferredSize.height, 28 ))
108
111
}
109
112
110
113
private fun createStatusIcon (): JComponent {
111
114
return when (task.status) {
112
- TaskStatus .COMPLETED -> JLabel (AutoDevIcons .Checked )
113
- TaskStatus .FAILED -> JLabel (AutoDevIcons .Error )
114
- TaskStatus .IN_PROGRESS -> JLabel (AutoDevIcons .Build )
115
+ TaskStatus .COMPLETED -> JLabel (AutoDevIcons .Checked ).apply {
116
+ preferredSize = Dimension (16 , 16 )
117
+ }
118
+
119
+ TaskStatus .FAILED -> JLabel (AutoDevIcons .Error ).apply {
120
+ preferredSize = Dimension (16 , 16 )
121
+ }
122
+
123
+ TaskStatus .IN_PROGRESS -> JLabel (AutoDevIcons .Build ).apply {
124
+ preferredSize = Dimension (16 , 16 )
125
+ }
126
+
115
127
TaskStatus .TODO -> JCheckBox ().apply {
116
128
isSelected = task.completed
117
129
addActionListener {
@@ -124,6 +136,7 @@ class TaskStepPanel(
124
136
isBorderPainted = false
125
137
isContentAreaFilled = false
126
138
background = JBUI .CurrentTheme .ToolWindow .background()
139
+ preferredSize = Dimension (16 , 16 )
127
140
}
128
141
}
129
142
}
@@ -132,13 +145,13 @@ class TaskStepPanel(
132
145
val editorColorsManager = EditorColorsManager .getInstance()
133
146
val currentScheme = editorColorsManager.schemeForCurrentUITheme
134
147
val editorFontName = currentScheme.editorFontName
135
- val editorFontSize = currentScheme.editorFontSize
148
+ val editorFontSize = currentScheme.editorFontSize - 1 // Slightly smaller font
136
149
137
150
return JTextPane ().apply {
138
151
isEditable = false
139
152
isOpaque = false
140
153
background = JBUI .CurrentTheme .ToolWindow .background()
141
- border = JBUI .Borders .emptyLeft(5 )
154
+ border = JBUI .Borders .emptyLeft(3 ) // Less left padding
142
155
font = Font (editorFontName, Font .PLAIN , editorFontSize)
143
156
foreground = UIUtil .getLabelForeground()
144
157
@@ -175,6 +188,15 @@ class TaskStepPanel(
175
188
var text = task.step
176
189
var currentPos = 0
177
190
191
+ taskLabel.toolTipText = text
192
+ val needsTruncation = text.length > MAX_TEXT_LENGTH && task.codeFileLinks.isEmpty()
193
+ if (needsTruncation && task.codeFileLinks.isEmpty()) {
194
+ val truncatedText = text.take(MAX_TEXT_LENGTH ) + " ..."
195
+ doc.insertString(0 , truncatedText, getStyleForStatus(task.status))
196
+ return
197
+ }
198
+
199
+ // If we have links or the text is short enough, use the normal rendering logic
178
200
task.codeFileLinks.forEach { link ->
179
201
val linkPattern = " [${link.displayText} ](${link.filePath} )"
180
202
val linkIndex = text.indexOf(linkPattern)
@@ -198,6 +220,9 @@ class TaskStepPanel(
198
220
}
199
221
200
222
if (text.isNotEmpty()) {
223
+ if (text.length > MAX_TEXT_LENGTH ) {
224
+ text = text.take(MAX_TEXT_LENGTH ) + " ..."
225
+ }
201
226
doc.insertString(currentPos, text, getStyleForStatus(task.status))
202
227
}
203
228
}
0 commit comments