-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,838 additions
and
1,440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...lugin/src/main/kotlin/com/itangcent/idea/plugin/configurable/AbstractEasyApiSettingGUI.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.itangcent.idea.plugin.configurable | ||
|
||
import com.itangcent.idea.plugin.settings.Settings | ||
import com.itangcent.intellij.extend.rx.AutoComputer | ||
import javax.swing.JComponent | ||
|
||
abstract class AbstractEasyApiSettingGUI : EasyApiSettingGUI { | ||
|
||
protected var settingsInstance: Settings? = null | ||
|
||
protected var autoComputer: AutoComputer = AutoComputer() | ||
|
||
override fun getSettings(): Settings { | ||
return (settingsInstance ?: Settings()).copy() | ||
} | ||
|
||
override fun setSettings(settings: Settings) { | ||
autoComputer.value(this::settingsInstance, settings.copy()) | ||
} | ||
|
||
override fun readSettings(settings: Settings) { | ||
this.settingsInstance?.let { readSettings(settings, it) } | ||
|
||
} | ||
|
||
protected abstract fun readSettings(settings: Settings, from: Settings) | ||
} |
35 changes: 35 additions & 0 deletions
35
idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/configurable/EasyApiConfigurable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.itangcent.idea.plugin.configurable | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.itangcent.idea.plugin.api.export.core.EasyApiConfigReader | ||
import com.itangcent.idea.plugin.dialog.EasyApiSettingGUI | ||
import com.itangcent.idea.plugin.settings.helper.MemoryPostmanSettingsHelper | ||
import com.itangcent.idea.plugin.settings.helper.PostmanSettingsHelper | ||
import com.itangcent.intellij.config.ConfigReader | ||
import com.itangcent.intellij.context.ActionContext | ||
import com.itangcent.intellij.extend.guice.singleton | ||
import com.itangcent.intellij.extend.guice.with | ||
import com.itangcent.intellij.file.DefaultLocalFileRepository | ||
import com.itangcent.intellij.file.LocalFileRepository | ||
import com.itangcent.suv.http.ConfigurableHttpClientProvider | ||
import com.itangcent.suv.http.HttpClientProvider | ||
|
||
class EasyApiConfigurable(myProject: Project?) : AbstractEasyApiConfigurable(myProject) { | ||
|
||
override fun getId(): String { | ||
return "preference.EasyApiConfigurable" | ||
} | ||
|
||
override fun getDisplayName(): String { | ||
return "EasyApi" | ||
} | ||
|
||
override fun createGUI(): com.itangcent.idea.plugin.configurable.EasyApiSettingGUI { | ||
return EasyApiSettingGUI() | ||
} | ||
|
||
override fun afterBuildActionContext(builder: ActionContext.ActionContextBuilder) { | ||
super.afterBuildActionContext(builder) | ||
builder.bind(PostmanSettingsHelper::class) { it.with(MemoryPostmanSettingsHelper::class).singleton() } | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...plugin/src/main/kotlin/com/itangcent/idea/plugin/configurable/EasyApiOtherConfigurable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.itangcent.idea.plugin.configurable | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.itangcent.idea.plugin.dialog.EasyApiSettingOtherGUI | ||
|
||
class EasyApiOtherConfigurable(myProject: Project?) : AbstractEasyApiConfigurable(myProject) { | ||
|
||
override fun getId(): String { | ||
return "preference.EasyApiConfigurable.Other" | ||
} | ||
|
||
override fun getDisplayName(): String { | ||
return "Other" | ||
} | ||
|
||
override fun createGUI(): EasyApiSettingGUI { | ||
return EasyApiSettingOtherGUI() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...in/src/main/kotlin/com/itangcent/idea/plugin/configurable/EasyApiRecommendConfigurable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.itangcent.idea.plugin.configurable | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.itangcent.idea.plugin.dialog.EasyApiSettingRecommendGUI | ||
|
||
class EasyApiRecommendConfigurable(myProject: Project?) : AbstractEasyApiConfigurable(myProject) { | ||
|
||
override fun getId(): String { | ||
return "preference.EasyApiConfigurable.Recommend" | ||
} | ||
|
||
override fun getDisplayName(): String { | ||
return "Recommend" | ||
} | ||
|
||
override fun createGUI(): EasyApiSettingGUI { | ||
return EasyApiSettingRecommendGUI() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
.../kotlin/com/itangcent/idea/plugin/configurable/EasyApiSettingBuiltInConfigConfigurable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.itangcent.idea.plugin.configurable | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.itangcent.idea.plugin.dialog.EasyApiSettingBuiltInConfigGUI | ||
|
||
class EasyApiSettingBuiltInConfigConfigurable(myProject: Project?) : AbstractEasyApiConfigurable(myProject) { | ||
|
||
override fun getId(): String { | ||
return "preference.EasyApiConfigurable.BuiltInConfig" | ||
} | ||
|
||
override fun getDisplayName(): String { | ||
return "BuiltInConfig" | ||
} | ||
|
||
override fun createGUI(): EasyApiSettingGUI { | ||
return EasyApiSettingBuiltInConfigGUI() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/configurable/EasyApiSettingGUI.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.itangcent.idea.plugin.configurable | ||
|
||
import com.itangcent.idea.plugin.settings.Settings | ||
import javax.swing.JComponent | ||
|
||
interface EasyApiSettingGUI { | ||
fun getRootPanel(): JComponent? | ||
|
||
fun onCreate() | ||
|
||
fun getSettings(): Settings | ||
|
||
fun setSettings(settings: Settings) | ||
|
||
fun readSettings(settings: Settings) | ||
} |
Oops, something went wrong.