1
1
package cc.unitmesh.terminal.sketch
2
2
3
+ import cc.unitmesh.devti.AutoDevIcons
3
4
import cc.unitmesh.devti.AutoDevNotifications
4
5
import cc.unitmesh.devti.agent.view.WebViewWindow
5
6
import cc.unitmesh.devti.sketch.SketchToolWindow
@@ -24,17 +25,21 @@ import com.intellij.terminal.JBTerminalWidget
24
25
import com.intellij.ui.components.panels.HorizontalLayout
25
26
import com.intellij.ui.components.panels.VerticalLayout
26
27
import com.intellij.ui.components.panels.Wrapper
28
+ import com.intellij.ui.scale.JBUIScale.scale
27
29
import com.intellij.util.ui.JBUI
28
30
import com.intellij.util.ui.UIUtil
29
31
import org.jetbrains.plugins.terminal.LocalTerminalDirectRunner
30
32
import java.awt.BorderLayout
31
33
import java.awt.Dimension
34
+ import java.awt.FlowLayout
32
35
import java.awt.event.MouseAdapter
33
36
import java.awt.event.MouseEvent
37
+ import javax.swing.Icon
34
38
import javax.swing.JButton
35
39
import javax.swing.JComponent
36
40
import javax.swing.JLabel
37
41
import javax.swing.JPanel
42
+ import javax.swing.SwingConstants
38
43
39
44
/* *
40
45
* TerminalSketch provide a support for `bash` and `shell` language in terminal.
@@ -79,7 +84,7 @@ class TerminalSketchProvider : LanguageSketchProvider {
79
84
add(toolbarWrapper)
80
85
add(terminalWidget!! .component)
81
86
82
- val sendButton = JButton (" Send" ).apply {
87
+ val sendButton = JButton (AutoDevIcons . Send ).apply {
83
88
addMouseListener(object : MouseAdapter () {
84
89
override fun mouseClicked (e : MouseEvent ? ) {
85
90
try {
@@ -93,16 +98,20 @@ class TerminalSketchProvider : LanguageSketchProvider {
93
98
})
94
99
}
95
100
96
- val popupButton = JButton (" Pop up Terminal" ).apply {
101
+ val popupButton = JButton (" Popup" ).apply {
102
+ icon = AllIcons .Ide .External_link_arrow
103
+ iconTextGap = scale(1 )
104
+ horizontalTextPosition = SwingConstants .LEADING
97
105
addMouseListener(executePopup(terminalWidget, project))
98
106
}
99
107
108
+ val buttonPanel = JPanel (FlowLayout (FlowLayout .RIGHT ))
100
109
buttonPanel.add(sendButton)
101
110
buttonPanel.add(popupButton)
111
+
102
112
add(buttonPanel)
103
113
}
104
114
}
105
-
106
115
terminalWidget!! .addMessageFilter(FrontendWebViewServerFilter (project, mainPanel!! ))
107
116
}
108
117
0 commit comments