1
1
package cc.unitmesh.devti.gui.toolbar
2
2
3
+ import cc.unitmesh.devti.AutoDevBundle
3
4
import com.intellij.openapi.actionSystem.AnActionEvent
4
5
import com.intellij.openapi.actionSystem.Presentation
5
6
import com.intellij.openapi.actionSystem.ex.CustomComponentAction
6
7
import com.intellij.openapi.project.DumbAwareAction
7
- import com.intellij.ui.components.JBLabel
8
- import com.intellij.util.ui.UIUtil
8
+ import com.intellij.ui.components.panels.Wrapper
9
+ import com.intellij.util.ui.JBInsets
10
+ import com.intellij.util.ui.JBUI
11
+ import javax.swing.JButton
9
12
import javax.swing.JComponent
10
13
11
14
class NewChatAction : DumbAwareAction (), CustomComponentAction {
@@ -14,8 +17,16 @@ class NewChatAction : DumbAwareAction(), CustomComponentAction {
14
17
}
15
18
16
19
override fun createCustomComponent (presentation : Presentation , place : String ): JComponent {
17
- val label = JBLabel (" New Chat" )
18
- label.font = UIUtil .getToolTipFont()
19
- return label
20
+ val message = AutoDevBundle .message(" devti.chat.new" )
21
+ val button: JButton = object : JButton (message) {
22
+ init {
23
+ putClientProperty(" ActionToolbar.smallVariant" , true )
24
+ putClientProperty(" customButtonInsets" , JBInsets (1 ).asUIResource())
25
+ setOpaque(false )
26
+ }
27
+ }
28
+ return Wrapper (button).also {
29
+ it.setBorder(JBUI .Borders .empty(0 , 10 ))
30
+ }
20
31
}
21
32
}
0 commit comments