Skip to content

Commit 9f66265

Browse files
committed
feat: add setting dialog
1 parent bbd8621 commit 9f66265

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.huayi.intellijplatform.gitstats.components
2+
3+
import com.huayi.intellijplatform.gitstats.MyBundle
4+
import com.intellij.openapi.ui.ComboBox
5+
import com.intellij.openapi.ui.DialogWrapper
6+
import com.intellij.ui.components.JBLabel
7+
import com.intellij.ui.components.JBPanel
8+
import java.awt.Dimension
9+
import java.awt.GridLayout
10+
import javax.swing.BoxLayout
11+
import javax.swing.JComponent
12+
13+
14+
class SettingDialogWrapper : DialogWrapper(true) {
15+
init {
16+
title = "Git Stats Setting"
17+
init()
18+
}
19+
override fun createCenterPanel(): JComponent {
20+
val dialogPanel = JBPanel<JBPanel<*>>().apply {
21+
layout = GridLayout(1, 1)
22+
preferredSize = Dimension(260, 30)
23+
}
24+
val modeFieldPanel = JBPanel<JBPanel<*>>().apply {
25+
layout = BoxLayout(this, BoxLayout.X_AXIS)
26+
add(JBLabel(MyBundle.message("settingDialogModeLabel", "")).apply {
27+
preferredSize = Dimension(50, 30)
28+
})
29+
add(ComboBox<String>().apply {
30+
addItem("Top-speed")
31+
addItem("Advanced")
32+
})
33+
}
34+
dialogPanel.add(modeFieldPanel)
35+
return dialogPanel
36+
}
37+
}

src/main/resources/messages/MyBundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ shuffle=Shuffle
55
filterStartTimeLabel=StartTime: {0}
66
filterEndTimeLabel=EndTime: {0}
77
refreshButtonLabel=Refresh
8+
settingButtonTooltipText=Show Setting
9+
settingDialogModeLabel=Mode:

0 commit comments

Comments
 (0)