@@ -172,26 +172,10 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
172
172
scrollPane.verticalScrollBarPolicy = JScrollPane .VERTICAL_SCROLLBAR_AS_NEEDED
173
173
scrollPane.horizontalScrollBarPolicy = JScrollPane .HORIZONTAL_SCROLLBAR_AS_NEEDED
174
174
175
- val clearButton = JButton (AutoDevBundle .message(" chat.panel.clear.all" )).apply {
176
- toolTipText = AutoDevBundle .message(" chat.panel.clear.all.tooltip" )
177
- addActionListener {
178
- val result = JOptionPane .showConfirmDialog(
179
- this @AutoDevInputSection,
180
- AutoDevBundle .message(" chat.panel.clear.all.confirm" ),
181
- AutoDevBundle .message(" chat.panel.clear.all.title" ),
182
- JOptionPane .YES_NO_OPTION
183
- )
184
-
185
- if (result == JOptionPane .YES_OPTION ) {
186
- while (listModel.size() > 3 ) {
187
- listModel.removeElementAt(listModel.size() - 1 )
188
- }
189
- }
190
- }
191
- }
175
+ val toolbar = setupToolbar()
192
176
193
177
val headerPanel = JPanel (BorderLayout ())
194
- headerPanel.add(clearButton , BorderLayout .NORTH )
178
+ headerPanel.add(toolbar , BorderLayout .NORTH )
195
179
headerPanel.add(scrollPane, BorderLayout .CENTER )
196
180
197
181
this .add(headerPanel, BorderLayout .NORTH )
@@ -303,6 +287,28 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
303
287
elements?.forEach { listModel.addIfAbsent(it.containingFile.virtualFile) }
304
288
}
305
289
290
+ private fun setupToolbar (): JToolBar {
291
+ val toolbar = JToolBar ()
292
+ toolbar.isFloatable = false
293
+
294
+ val reminderLabel = JBLabel (AutoDevBundle .message(" chat.panel.select.files" ))
295
+ reminderLabel.border = JBUI .Borders .empty(5 )
296
+ reminderLabel.foreground = UIUtil .getContextHelpForeground()
297
+ toolbar.add(reminderLabel)
298
+
299
+ toolbar.add(Box .createHorizontalGlue())
300
+
301
+ val clearButton = JButton (AutoDevBundle .message(" chat.panel.clear.all" )).apply {
302
+ toolTipText = AutoDevBundle .message(" chat.panel.clear.all.tooltip" )
303
+ addActionListener {
304
+ listModel.removeAllElements()
305
+ }
306
+ }
307
+
308
+ toolbar.add(clearButton)
309
+ return toolbar
310
+ }
311
+
306
312
fun showStopButton () {
307
313
(buttonPanel.layout as ? CardLayout )?.show(buttonPanel, " Stop" )
308
314
stopButton.isEnabled = true
0 commit comments