Skip to content

Commit 178853e

Browse files
committed
feat(ui): change to button style
1 parent 0acbc27 commit 178853e

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package cc.unitmesh.devti.gui.toolbar
22

3+
import cc.unitmesh.devti.AutoDevBundle
34
import com.intellij.openapi.actionSystem.AnActionEvent
45
import com.intellij.openapi.actionSystem.Presentation
56
import com.intellij.openapi.actionSystem.ex.CustomComponentAction
67
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
912
import javax.swing.JComponent
1013

1114
class NewChatAction : DumbAwareAction(), CustomComponentAction {
@@ -14,8 +17,16 @@ class NewChatAction : DumbAwareAction(), CustomComponentAction {
1417
}
1518

1619
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+
}
2031
}
2132
}

src/main/resources/messages/AutoDevBundle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ devti.progress.creatingServiceAndRepository=Create Service and Repository (5/5)
1010
# Config
1111
autodev.flow=AutoDev Flow
1212
devti.chat.send=Send
13+
devti.chat.new=New Chat
1314
devti.chat.replaceSelection=Replace Selection
1415
devti.loading=Loading...
1516
chat.label.initial.text='Enter' to start, 'Shift+Enter' for a new line

0 commit comments

Comments
 (0)