File tree Expand file tree Collapse file tree 7 files changed +66
-12
lines changed
kotlin/irony/pycharm/qsseditor Expand file tree Collapse file tree 7 files changed +66
-12
lines changed Original file line number Diff line number Diff line change 55! ** /src /test /** /build /
66
77# ## IntelliJ IDEA ###
8+ .idea
89.idea /modules.xml
910.idea /jarRepositories.xml
1011.idea /compiler.xml
Original file line number Diff line number Diff line change @@ -2,15 +2,10 @@ package irony.pycharm.qsseditor
22
33import com.intellij.openapi.actionSystem.AnAction
44import com.intellij.openapi.actionSystem.AnActionEvent
5- import com.intellij.openapi.actionSystem.CommonDataKeys
6- import com.intellij.openapi.project.Project
7- import com.intellij.openapi.ui.Messages
85
96
10- class ApplyAction : AnAction () {
7+ class ApplyAction : AnAction (LangBundle .message("action.apply.title", " Apply Style ") ) {
118 override fun actionPerformed (e : AnActionEvent ) {
12- // TODO: insert action logic here
13- val project: Project ? = e.project
14- Messages .showInfoMessage(e.getData(CommonDataKeys .PSI_ELEMENT ).toString(), " Caret Parameters Inside The Editor" )
9+
1510 }
1611}
Original file line number Diff line number Diff line change 1+ package irony.pycharm.qsseditor
2+
3+ import com.intellij.DynamicBundle
4+ import org.jetbrains.annotations.Nls
5+ import org.jetbrains.annotations.NonNls
6+ import org.jetbrains.annotations.Nullable
7+ import org.jetbrains.annotations.PropertyKey
8+ import java.util.function.Supplier
9+
10+ object LangBundle {
11+ private const val BUNDLE : @NonNls String = " messages.LangBundle"
12+ private val INSTANCE = DynamicBundle (LangBundle ::class .java, BUNDLE )
13+
14+ fun message (
15+ key : @PropertyKey(resourceBundle = BUNDLE ) String ,
16+ vararg params : Any
17+ ): @Nls String {
18+ return INSTANCE .messageOrDefault(key, key, * params)
19+ }
20+
21+ fun message (
22+ key : @PropertyKey(resourceBundle = BUNDLE ) String ,
23+ @Nullable @Nls defaultValue : String ,
24+ vararg params : Any
25+ ): @Nls String {
26+ return INSTANCE .messageOrDefault(key, defaultValue, * params)
27+ }
28+
29+ fun lazyMessage (
30+ @PropertyKey(resourceBundle = BUNDLE ) key : String ,
31+ vararg params : Any
32+ ): Supplier <@Nls String > {
33+ return INSTANCE .getLazyMessage(key, * params)
34+ }
35+ }
Original file line number Diff line number Diff line change @@ -2,15 +2,28 @@ package irony.pycharm.qsseditor
22
33import com.intellij.openapi.options.BoundSearchableConfigurable
44import com.intellij.openapi.options.Configurable.NoScroll
5+ import com.intellij.openapi.ui.DialogPanel
6+ import com.intellij.ui.dsl.builder.bindIntText
7+ import com.intellij.ui.dsl.builder.bindSelected
8+ import com.intellij.ui.dsl.builder.bindText
59import com.intellij.ui.dsl.builder.panel
610
711class SettingsConfigurable : BoundSearchableConfigurable (
8- " QSS" ,
9- " QSS Editor Configurable"
12+ " QSS Editor " ,
13+ LangBundle .message("setting.topic.title", " QSS Editor Configurable ")
1014), NoScroll {
1115
12- override fun createPanel () = panel {
13- row {
16+ override fun createPanel () : DialogPanel {
17+ return panel {
18+ row(LangBundle .message(" setting.host.title" , " Host" )) {
19+ textField().bindText(SettingsState .instance::host)
20+ }
21+ row(LangBundle .message(" setting.port.title" , " Port" )) {
22+ textField().bindIntText(SettingsState .instance::port)
23+ }
24+ row(LangBundle .message(" setting.auto.title" ," Auto Apply" )) {
25+ checkBox(" " ).bindSelected(SettingsState .instance::auto)
26+ }
1427 }
1528 }
1629}
Original file line number Diff line number Diff line change 3535 displayName =" QSS" />
3636 </extensions >
3737 <actions >
38- <action id =" ApplyAction" class =" irony.pycharm.qsseditor.ApplyAction" text = " Apply Style " description = " Apply Style " >
38+ <action id =" ApplyAction" class =" irony.pycharm.qsseditor.ApplyAction" >
3939 <add-to-group group-id =" EditorPopupMenu" anchor =" first" />
4040 </action >
4141 </actions >
Original file line number Diff line number Diff line change 1+ action.apply.title =Apply Style
2+ setting.topic.title =QSS Editor Configurable
3+ setting.auto.title =Auto Apply
4+ setting.host.title =Host
5+ setting.port.title =Port
Original file line number Diff line number Diff line change 1+ action.apply.title =应用样式
2+ setting.topic.title =QSS 编辑器配置
3+ setting.auto.title =自动应用
4+ setting.host.title =地址
5+ setting.port.title =端口
You can’t perform that action at this time.
0 commit comments