mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
[RDCT] IJPL-170114: Add an ability to save settings components under a foreign clientId
Sometimes there is a need to save settings under a remote clientId. This wasn't possible before, because in `ComponentStoreImpl#commitComponents` an original component for the Host clientId was always taken. This commit fixes that, getting a correct component for per-client components under a remote clientId. (cherry picked from commit d2da4442de6dacbaa704bb59386b9fc94f655a1a) GitOrigin-RevId: f36a55f42675879abbc5c3806e1e508711fb13ac
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0e4ea7d7ef
commit
ad13cd0ee0
@@ -230,6 +230,20 @@ abstract class ComponentStoreImpl : IComponentStore {
|
|||||||
saveSessionManager.save(saveResult)
|
saveSessionManager.save(saveResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getClientAwareComponentInfo(name: String): ComponentInfo? {
|
||||||
|
val info = components.get(name) ?: return null
|
||||||
|
if (info.stateSpec?.perClient != true || ClientId.isCurrentlyUnderLocalId)
|
||||||
|
return info
|
||||||
|
|
||||||
|
val componentManager = storageManager.componentManager ?: application
|
||||||
|
val componentClass = info.component.javaClass
|
||||||
|
val clientComponent = componentManager.getService(componentClass)
|
||||||
|
if (clientComponent == null || clientComponent === info.component)
|
||||||
|
return info
|
||||||
|
|
||||||
|
return ComponentInfoImpl(info.pluginId, clientComponent, info.stateSpec)
|
||||||
|
}
|
||||||
|
|
||||||
internal open suspend fun commitComponents(isForce: Boolean, sessionManager: SaveSessionProducerManager, saveResult: SaveResult) {
|
internal open suspend fun commitComponents(isForce: Boolean, sessionManager: SaveSessionProducerManager, saveResult: SaveResult) {
|
||||||
val names = ArrayUtilRt.toStringArray(components.keys)
|
val names = ArrayUtilRt.toStringArray(components.keys)
|
||||||
if (names.isEmpty()) {
|
if (names.isEmpty()) {
|
||||||
@@ -248,7 +262,7 @@ abstract class ComponentStoreImpl : IComponentStore {
|
|||||||
for (name in names) {
|
for (name in names) {
|
||||||
val start = System.currentTimeMillis()
|
val start = System.currentTimeMillis()
|
||||||
try {
|
try {
|
||||||
val info = components.get(name) ?: continue
|
val info = getClientAwareComponentInfo(name) ?: continue
|
||||||
var currentModificationCount = -1L
|
var currentModificationCount = -1L
|
||||||
|
|
||||||
if (info.lastSaved != -1) {
|
if (info.lastSaved != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user