File tree Expand file tree Collapse file tree 9 files changed +71
-53
lines changed
kotlin/irony/pycharm/qsseditor Expand file tree Collapse file tree 9 files changed +71
-53
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ package irony.pycharm.qsseditor
2+
3+ import com.intellij.openapi.actionSystem.AnAction
4+ import com.intellij.openapi.actionSystem.AnActionEvent
5+ import com.intellij.openapi.actionSystem.CommonDataKeys
6+ import com.intellij.openapi.editor.Editor
7+ import com.intellij.openapi.project.Project
8+
9+
10+ class QSSAction : AnAction (QSSBundle .message("action.apply.title", "Apply Style ")) {
11+
12+ override fun update (e : AnActionEvent ) {
13+ e.presentation.isEnabledAndVisible = false
14+ val project: Project = e.project ? : return
15+ val editor: Editor = e.getData(CommonDataKeys .EDITOR ) ? : return
16+ }
17+
18+ override fun actionPerformed (e : AnActionEvent ) {
19+
20+ }
21+ }
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ import org.jetbrains.annotations.Nullable
77import org.jetbrains.annotations.PropertyKey
88import java.util.function.Supplier
99
10- object LangBundle {
11- private const val BUNDLE : @NonNls String = " messages.LangBundle "
12- private val INSTANCE = DynamicBundle (LangBundle ::class .java, BUNDLE )
10+ object QSSBundle {
11+ private const val BUNDLE : @NonNls String = " messages.QSSBundle "
12+ private val INSTANCE = DynamicBundle (QSSBundle ::class .java, BUNDLE )
1313
1414 fun message (
1515 key : @PropertyKey(resourceBundle = BUNDLE ) String ,
Original file line number Diff line number Diff line change 1+ package irony.pycharm.qsseditor
2+
3+ import com.intellij.openapi.options.BoundSearchableConfigurable
4+ import 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
9+ import com.intellij.ui.dsl.builder.panel
10+
11+ class QSSConfigurable : BoundSearchableConfigurable (
12+ " QSS Editor" ,
13+ QSSBundle .message("setting.topic.title", "QSS Editor Configurable ")
14+ ), NoScroll {
15+
16+ override fun createPanel () : DialogPanel {
17+ return panel {
18+ row(QSSBundle .message(" setting.host.title" , " Host" )) {
19+ textField().bindText(QSSService .instance::host)
20+ }
21+ row(QSSBundle .message(" setting.port.title" , " Port" )) {
22+ textField().bindIntText(QSSService .instance::port)
23+ }
24+ row(QSSBundle .message(" setting.auto.title" ," Auto Apply" )) {
25+ checkBox(" " ).bindSelected(QSSService .instance::auto)
26+ }
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change @@ -5,25 +5,33 @@ import com.intellij.openapi.components.PersistentStateComponent
55import com.intellij.openapi.components.State
66import com.intellij.openapi.components.Storage
77import com.intellij.util.xmlb.XmlSerializerUtil
8+ import kotlinx.coroutines.CoroutineScope
9+ import kotlinx.coroutines.launch
810
9- @State(name = " irony.pycharm.qsseditor.SettingsState" , storages = [Storage (" QSSEditorSetting.xml" )])
10- internal class SettingsState : PersistentStateComponent <SettingsState > {
11+ @State(name = " irony.pycharm.qsseditor.QSSService" , storages = [Storage (" QSSEditorSetting.xml" )])
12+ internal class QSSService (private val cs : CoroutineScope ) : PersistentStateComponent<QSSService> {
13+ private var inited: Boolean = false ;
1114 var auto: Boolean = true
1215 var host: String = " localhost"
1316 var port: Int = 61052
1417
15- override fun getState (): SettingsState {
18+ override fun getState (): QSSService {
1619 return this
1720 }
1821
19- override fun loadState (state : SettingsState ) {
22+ override fun loadState (state : QSSService ) {
2023 XmlSerializerUtil .copyBean(state, this )
2124 }
2225
2326 companion object {
24- val instance: SettingsState
27+ val instance: QSSService
2528 get() = ApplicationManager .getApplication().getService(
26- SettingsState ::class .java
29+ QSSService ::class .java
2730 )
2831 }
32+
33+ fun initialize () {
34+ if (! inited) {
35+ }
36+ }
2937}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2626 Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
2727 <extensions defaultExtensionNs =" com.intellij" >
2828 <applicationService
29- serviceImplementation =" irony.pycharm.qsseditor.SettingsState " />
29+ serviceImplementation =" irony.pycharm.qsseditor.QSSService " />
3030 <applicationConfigurable
3131 parentId =" language"
3232 groupWeight =" -500"
33- instance =" irony.pycharm.qsseditor.SettingsConfigurable "
34- id =" irony.pycharm.qsseditor.SettingsConfigurable "
33+ instance =" irony.pycharm.qsseditor.QSSConfigurable "
34+ id =" irony.pycharm.qsseditor.QSSConfigurable "
3535 displayName =" QSS" />
3636 </extensions >
3737 <actions >
38- <action id =" ApplyAction" class =" irony.pycharm.qsseditor.ApplyAction " >
38+ <action id =" ApplyAction" class =" irony.pycharm.qsseditor.QSSAction " >
3939 <add-to-group group-id =" EditorPopupMenu" anchor =" first" />
4040 </action >
4141 </actions >
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments