Skip to content

Commit 2302360

Browse files
committed
feat: Implement dependency management in settings configurations
1 parent d5b251d commit 2302360

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/main/kotlin/nl/deschepers/laraveltinker/settings/GlobalSettingsConfigurable.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package nl.deschepers.laraveltinker.settings
22

3+
import com.intellij.openapi.extensions.BaseExtensionPointName
34
import com.intellij.openapi.options.Configurable
45
import nl.deschepers.laraveltinker.Strings
56
import javax.swing.JComponent
67

7-
class GlobalSettingsConfigurable : Configurable {
8+
class GlobalSettingsConfigurable : Configurable, Configurable.WithEpDependencies {
89
private var appSettingsComponent: GlobalSettingsComponent = GlobalSettingsComponent()
910

1011
override fun createComponent(): JComponent {
@@ -41,4 +42,8 @@ class GlobalSettingsConfigurable : Configurable {
4142
override fun getDisplayName(): String {
4243
return Strings.getMessage("name")
4344
}
45+
46+
override fun getDependencies(): Collection<BaseExtensionPointName<*>?> {
47+
return emptyList()
48+
}
4449
}

src/main/kotlin/nl/deschepers/laraveltinker/settings/GlobalSettingsState.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package nl.deschepers.laraveltinker.settings
22

3+
import com.intellij.openapi.Disposable
34
import com.intellij.openapi.application.ApplicationManager
45
import com.intellij.openapi.components.PersistentStateComponent
56
import com.intellij.openapi.components.State
@@ -10,7 +11,7 @@ import com.intellij.util.xmlb.XmlSerializerUtil
1011
name = "nl.deschepers.laraveltinker.settings.AppSettingsState",
1112
storages = [Storage("laravel-tinker-plugin-settings.xml")]
1213
)
13-
class GlobalSettingsState : PersistentStateComponent<GlobalSettingsState> {
14+
class GlobalSettingsState : PersistentStateComponent<GlobalSettingsState>, Disposable {
1415
var showExecutionStarted = true
1516
var showExecutionEnded = true
1617
var useWordWrapping = true
@@ -30,4 +31,8 @@ class GlobalSettingsState : PersistentStateComponent<GlobalSettingsState> {
3031
override fun loadState(state: GlobalSettingsState) {
3132
XmlSerializerUtil.copyBean(state, this)
3233
}
34+
35+
override fun dispose() {
36+
//
37+
}
3338
}

src/main/kotlin/nl/deschepers/laraveltinker/settings/PersistentApplicationCache.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package nl.deschepers.laraveltinker.settings
22

3+
import com.intellij.openapi.Disposable
34
import com.intellij.openapi.application.ApplicationManager
45
import com.intellij.openapi.components.PersistentStateComponent
56
import com.intellij.openapi.components.State
67
import com.intellij.openapi.components.Storage
78

89
@State(reloadable = true, name = "laravelTinker", storages = [Storage("laravel-tinker-plugin.xml")])
9-
class PersistentApplicationCache : PersistentStateComponent<PersistentApplicationCache.State> {
10+
class PersistentApplicationCache : PersistentStateComponent<PersistentApplicationCache.State>, Disposable {
1011
companion object {
1112
val instance: PersistentApplicationCache
1213
get() =
@@ -28,4 +29,8 @@ class PersistentApplicationCache : PersistentStateComponent<PersistentApplicatio
2829
override fun loadState(state: State) {
2930
cacheState = state
3031
}
32+
33+
override fun dispose() {
34+
//
35+
}
3136
}

src/main/kotlin/nl/deschepers/laraveltinker/settings/ProjectSettingsConfigurable.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package nl.deschepers.laraveltinker.settings
22

3+
import com.intellij.openapi.extensions.BaseExtensionPointName
34
import com.intellij.openapi.options.Configurable
45
import com.intellij.openapi.options.ConfigurationException
56
import com.intellij.openapi.project.Project
67
import nl.deschepers.laraveltinker.Strings
78
import javax.swing.JComponent
89

9-
class ProjectSettingsConfigurable(private var project: Project) : Configurable {
10+
class ProjectSettingsConfigurable(private var project: Project) : Configurable, Configurable.WithEpDependencies {
1011
private var projectSettingsComponent: ProjectSettingsComponent = ProjectSettingsComponent()
1112

1213
override fun createComponent(): JComponent {
@@ -52,4 +53,8 @@ class ProjectSettingsConfigurable(private var project: Project) : Configurable {
5253
override fun getDisplayName(): String {
5354
return Strings.getMessage("name")
5455
}
56+
57+
override fun getDependencies(): Collection<BaseExtensionPointName<*>?> {
58+
return emptyList()
59+
}
5560
}

0 commit comments

Comments
 (0)