-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from makeevrserg/compose-feature
- fix saved value - add klibs.kstorage - fix scopes - fix packages
- Loading branch information
Showing
27 changed files
with
212 additions
and
160 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
12 changes: 0 additions & 12 deletions
12
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/core/BaseViewModel.kt
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/core/CoroutineFeature.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,17 @@ | ||
package com.makeevrserg.mvikotlin.intellij.core | ||
|
||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.SupervisorJob | ||
import kotlinx.coroutines.swing.Swing | ||
import kotlin.coroutines.CoroutineContext | ||
|
||
interface CoroutineFeature : CoroutineScope { | ||
class Io : CoroutineFeature { | ||
override val coroutineContext: CoroutineContext = Dispatchers.IO + SupervisorJob() | ||
} | ||
|
||
class Main : CoroutineFeature { | ||
override val coroutineContext: CoroutineContext = Dispatchers.Swing + SupervisorJob() | ||
} | ||
} |
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
15 changes: 0 additions & 15 deletions
15
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/dependencies/Dependencies.kt
This file was deleted.
Oops, something went wrong.
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
17 changes: 17 additions & 0 deletions
17
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/krate/IntellijMutableKrate.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,17 @@ | ||
package com.makeevrserg.mvikotlin.intellij.krate | ||
|
||
import ru.astrainteractive.klibs.kstorage.api.MutableKrate | ||
|
||
interface IntellijMutableKrate<T> : MutableKrate<T> { | ||
val key: String | ||
|
||
var value: T | ||
get() = loadAndGet() | ||
set(value) { | ||
save(value) | ||
} | ||
|
||
fun asPair(): Pair<String, T> { | ||
return key to value | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/krate/impl/BooleanStorageValue.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,17 @@ | ||
package com.makeevrserg.mvikotlin.intellij.krate.impl | ||
|
||
import com.intellij.ide.util.PropertiesComponent | ||
import com.makeevrserg.mvikotlin.intellij.krate.IntellijMutableKrate | ||
import ru.astrainteractive.klibs.kstorage.api.MutableKrate | ||
import ru.astrainteractive.klibs.kstorage.api.impl.DefaultMutableKrate | ||
|
||
internal class BooleanStorageValue( | ||
override val key: String, | ||
private val properties: PropertiesComponent, | ||
private val default: Boolean | ||
) : IntellijMutableKrate<Boolean>, | ||
MutableKrate<Boolean> by DefaultMutableKrate( | ||
factory = { default }, | ||
saver = { properties.setValue(key, it) }, | ||
loader = { properties.getBoolean(key, default) } | ||
) |
24 changes: 24 additions & 0 deletions
24
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/krate/impl/EnumStorageValue.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,24 @@ | ||
package com.makeevrserg.mvikotlin.intellij.krate.impl | ||
|
||
import com.intellij.ide.util.PropertiesComponent | ||
import com.makeevrserg.mvikotlin.intellij.krate.IntellijMutableKrate | ||
import ru.astrainteractive.klibs.kstorage.api.MutableKrate | ||
import ru.astrainteractive.klibs.kstorage.api.impl.DefaultMutableKrate | ||
import kotlin.enums.EnumEntries | ||
|
||
internal class EnumStorageValue<T : Enum<T>>( | ||
override val key: String, | ||
private val properties: PropertiesComponent, | ||
initial: T, | ||
entries: EnumEntries<T> | ||
) : IntellijMutableKrate<T>, | ||
MutableKrate<T> by DefaultMutableKrate( | ||
factory = { initial }, | ||
saver = { | ||
properties.setValue(key, initial.ordinal.toString()) | ||
}, | ||
loader = { | ||
val index = properties.getValue(key)?.toIntOrNull() ?: 0 | ||
entries.getOrNull(index) ?: entries.first() | ||
} | ||
) |
21 changes: 21 additions & 0 deletions
21
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/krate/impl/InMemoryStorageValue.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,21 @@ | ||
package com.makeevrserg.mvikotlin.intellij.krate.impl | ||
|
||
import com.makeevrserg.mvikotlin.intellij.krate.IntellijMutableKrate | ||
import ru.astrainteractive.klibs.kstorage.api.MutableKrate | ||
import ru.astrainteractive.klibs.kstorage.api.impl.DefaultMutableKrate | ||
|
||
internal fun <T> inMemoryStorageValue( | ||
key: String, | ||
default: T | ||
): IntellijMutableKrate<T> { | ||
var value = default | ||
return object : | ||
IntellijMutableKrate<T>, | ||
MutableKrate<T> by DefaultMutableKrate( | ||
factory = { value }, | ||
saver = { newValue -> value = newValue }, | ||
loader = { value } | ||
) { | ||
override val key: String = key | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/storage/StorageValue.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/storage/impl/BooleanStorageValue.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
core/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/storage/impl/InMemoryStorageValue.kt
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ makeevrserg.java.ktarget=17 | |
# Project | ||
makeevrserg.project.name=MVIKotlin-IntelliJ-Plugin | ||
makeevrserg.project.group=com.makeevrserg.mvikotlin.intellij.plugin | ||
makeevrserg.project.version.string=0.4.0 | ||
makeevrserg.project.version.string=0.5.0 | ||
makeevrserg.project.description=IntelliJ Plugin for MVIKotlin/Decompose library | ||
makeevrserg.project.developers=makeevrserg|Makeev Roman|[email protected] | ||
makeevrserg.project.url=https://empireprojekt.ru | ||
|
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
17 changes: 0 additions & 17 deletions
17
plugin/src/main/kotlin/com/makeevrserg/mvikotlin/intellij/component/ComponentContract.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.