mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
GitOrigin-RevId: 872122679caae8571c1edf88adb6f7e0a31b7aab
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ce127c3983
commit
583d835f4a
@@ -1,4 +1,5 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
@file:Suppress("ReplaceGetOrSet")
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.configurationStore.statistic.eventLog.FeatureUsageSettingsEvents
|
||||
@@ -20,8 +21,8 @@ import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.openapi.util.*
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.util.use
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
|
||||
import com.intellij.util.ArrayUtilRt
|
||||
import com.intellij.util.SmartList
|
||||
@@ -41,6 +42,7 @@ import java.io.IOException
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.function.Consumer
|
||||
|
||||
internal val LOG = logger<ComponentStoreImpl>()
|
||||
private val SAVE_MOD_LOG = Logger.getInstance("#configurationStore.save.skip")
|
||||
@@ -87,9 +89,9 @@ abstract class ComponentStoreImpl : IComponentStore {
|
||||
internal fun getComponents(): Map<String, ComponentInfo> = components
|
||||
|
||||
override fun clearCaches() {
|
||||
components.values.forEach {
|
||||
components.values.forEach(Consumer {
|
||||
it.updateModificationCount(-1)
|
||||
}
|
||||
})
|
||||
(storageManager as? StateStorageManagerImpl)?.clearStorages()
|
||||
}
|
||||
|
||||
@@ -107,8 +109,8 @@ abstract class ComponentStoreImpl : IComponentStore {
|
||||
return
|
||||
}
|
||||
|
||||
val info = createComponentInfo(component, stateSpec, serviceDescriptor)
|
||||
initComponent(info, null, ThreeState.NO)
|
||||
val info = createComponentInfo(component, null, serviceDescriptor)
|
||||
initComponent(info = info, changedStorages = null, reloadData = ThreeState.NO)
|
||||
}
|
||||
else {
|
||||
componentName = stateSpec.name
|
||||
|
||||
+12
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.module.impl
|
||||
|
||||
import com.intellij.configurationStore.SaveSessionProducer
|
||||
@@ -11,7 +11,6 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.util.messages.MessageBus
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
@ApiStatus.Internal
|
||||
internal class NonPersistentModuleStore : ModuleStore {
|
||||
@@ -19,7 +18,11 @@ internal class NonPersistentModuleStore : ModuleStore {
|
||||
override fun setPath(path: Path): Unit = Unit
|
||||
override fun setPath(path: Path, virtualFile: VirtualFile?, isNew: Boolean) {
|
||||
}
|
||||
|
||||
override fun initComponent(component: Any, serviceDescriptor: ServiceDescriptor?, pluginId: PluginId?): Unit = Unit
|
||||
override fun unloadComponent(component: Any) {
|
||||
}
|
||||
|
||||
override fun initPersistencePlainComponent(component: Any, key: String): Unit = Unit
|
||||
override fun reloadStates(componentNames: Set<String>, messageBus: MessageBus): Unit = Unit
|
||||
override fun reloadState(componentClass: Class<out PersistentStateComponent<*>>): Unit = Unit
|
||||
@@ -28,6 +31,12 @@ internal class NonPersistentModuleStore : ModuleStore {
|
||||
override fun saveComponent(component: PersistentStateComponent<*>): Unit = Unit
|
||||
override fun removeComponent(name: String) {
|
||||
}
|
||||
|
||||
override fun clearCaches() {
|
||||
}
|
||||
|
||||
override fun release() {
|
||||
}
|
||||
}
|
||||
|
||||
private object NonPersistentStateStorageManager : StateStorageManager {
|
||||
@@ -36,7 +45,7 @@ private object NonPersistentStateStorageManager : StateStorageManager {
|
||||
override fun addStreamProvider(provider: StreamProvider, first: Boolean) = Unit
|
||||
override fun removeStreamProvider(clazz: Class<out StreamProvider>) = Unit
|
||||
override fun getOldStorage(component: Any, componentName: String, operation: StateStorageOperation): StateStorage? = null
|
||||
override fun expandMacro(path: String): Path = Paths.get(path)
|
||||
override fun expandMacro(collapsedPath: String): Path = Path.of(collapsedPath)
|
||||
}
|
||||
|
||||
private object NonPersistentStateStorage : StateStorage {
|
||||
|
||||
@@ -149,6 +149,9 @@ class ClientSessionComponentStore : IComponentStore {
|
||||
}
|
||||
}
|
||||
|
||||
override fun unloadComponent(component: Any) {
|
||||
}
|
||||
|
||||
override fun initPersistencePlainComponent(component: Any, key: String) {
|
||||
}
|
||||
|
||||
@@ -170,6 +173,12 @@ class ClientSessionComponentStore : IComponentStore {
|
||||
|
||||
override fun removeComponent(name: String) {
|
||||
}
|
||||
|
||||
override fun clearCaches() {
|
||||
}
|
||||
|
||||
override fun release() {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
+4
-8
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.components.impl.stores
|
||||
|
||||
import com.intellij.configurationStore.SaveSession
|
||||
@@ -21,9 +21,7 @@ interface IComponentStore {
|
||||
|
||||
fun initComponent(component: Any, serviceDescriptor: ServiceDescriptor?, pluginId: PluginId?)
|
||||
|
||||
@JvmDefault
|
||||
fun unloadComponent(component: Any) {
|
||||
}
|
||||
fun unloadComponent(component: Any)
|
||||
|
||||
fun initPersistencePlainComponent(component: Any, @NlsSafe key: String)
|
||||
|
||||
@@ -42,11 +40,9 @@ interface IComponentStore {
|
||||
fun removeComponent(name: String)
|
||||
|
||||
@TestOnly
|
||||
@JvmDefault
|
||||
fun clearCaches() {}
|
||||
fun clearCaches()
|
||||
|
||||
@JvmDefault
|
||||
fun release() {}
|
||||
fun release()
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
+7
-8
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.serviceContainer
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
@@ -32,16 +32,15 @@ internal class ServiceComponentAdapter(val descriptor: ServiceDescriptor,
|
||||
}
|
||||
}
|
||||
|
||||
if (indicator == null) {
|
||||
val progressManager = if (indicator == null) null else ProgressManager.getInstance()
|
||||
if (progressManager == null || progressManager.isInNonCancelableSection) {
|
||||
return createAndInitialize(componentManager, implementationClass)
|
||||
}
|
||||
|
||||
// don't use here computeInNonCancelableSection - it is kotlin and no need of such awkward and stack-trace unfriendly methods
|
||||
var instance: T? = null
|
||||
ProgressManager.getInstance().executeNonCancelableSection {
|
||||
instance = createAndInitialize(componentManager, implementationClass)
|
||||
else {
|
||||
return progressManager.computeInNonCancelableSection<T, Exception> {
|
||||
createAndInitialize(componentManager, implementationClass)
|
||||
}
|
||||
}
|
||||
return instance!!
|
||||
}
|
||||
|
||||
private fun <T : Any> createAndInitialize(componentManager: ComponentManagerImpl, implementationClass: Class<T>): T {
|
||||
|
||||
+10
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.serviceContainer
|
||||
|
||||
import com.intellij.configurationStore.StateStorageManager
|
||||
@@ -36,6 +36,9 @@ private class TestComponentStore : IComponentStore {
|
||||
override fun initComponent(component: Any, serviceDescriptor: ServiceDescriptor?, pluginId: PluginId?) {
|
||||
}
|
||||
|
||||
override fun unloadComponent(component: Any) {
|
||||
}
|
||||
|
||||
override fun initPersistencePlainComponent(component: Any, key: String) {
|
||||
}
|
||||
|
||||
@@ -55,4 +58,10 @@ private class TestComponentStore : IComponentStore {
|
||||
|
||||
override fun removeComponent(name: String) {
|
||||
}
|
||||
|
||||
override fun clearCaches() {
|
||||
}
|
||||
|
||||
override fun release() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user