mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
run manager workspace scheme manager — do not use VFS (more clear code), part 2
This commit is contained in:
@@ -13,6 +13,7 @@ import com.intellij.openapi.options.SchemeManagerFactory
|
||||
import com.intellij.openapi.options.SchemeProcessor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.ThreeState
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.lang.CompoundRuntimeException
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
@@ -36,9 +37,10 @@ sealed class SchemeManagerFactoryBase : SchemeManagerFactory(), SettingsSavingCo
|
||||
streamProvider: StreamProvider?,
|
||||
directoryPath: Path?,
|
||||
isAutoSave: Boolean,
|
||||
isUseVfs: Boolean): SchemeManager<T> {
|
||||
isUseVfs: ThreeState): SchemeManager<T> {
|
||||
val path = checkPath(directoryName)
|
||||
val messageBus = componentManager?.messageBus
|
||||
val isUseVfsEffective = if (isUseVfs == ThreeState.UNSURE) this.isUseVfs else isUseVfs.toBoolean()
|
||||
val manager = SchemeManagerImpl(path,
|
||||
processor,
|
||||
streamProvider ?: (componentManager?.stateStore?.storageManager as? StateStorageManagerImpl)?.compoundStreamProvider,
|
||||
@@ -46,7 +48,7 @@ sealed class SchemeManagerFactoryBase : SchemeManagerFactory(), SettingsSavingCo
|
||||
roamingType,
|
||||
presentableName,
|
||||
schemeNameToFileName,
|
||||
if (isUseVfs && messageBus != null && (streamProvider == null || !streamProvider.isApplicable(path, roamingType))) messageBus else null)
|
||||
if (isUseVfsEffective && messageBus != null && (streamProvider == null || !streamProvider.isApplicable(path, roamingType))) messageBus else null)
|
||||
if (isAutoSave) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
managers.add(manager as SchemeManagerImpl<Scheme, Scheme>)
|
||||
|
||||
@@ -107,7 +107,7 @@ open class RunManagerImpl(internal val project: Project) : RunManagerEx(), Persi
|
||||
isShared = false,
|
||||
isWrapSchemeIntoComponentElement = false),
|
||||
streamProvider = workspaceSchemeManagerProvider,
|
||||
isAutoSave = false, isUseVfs = false)
|
||||
isAutoSave = false, isUseVfs = ThreeState.NO)
|
||||
|
||||
@Suppress("LeakingThis")
|
||||
private var projectSchemeManager = SchemeManagerFactory.getInstance(project).create("runConfigurations",
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.configurationStore.StreamProvider
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.ThreeState
|
||||
import org.jdom.Parent
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -42,7 +43,7 @@ abstract class SchemeManagerFactory {
|
||||
streamProvider: StreamProvider? = null,
|
||||
directoryPath: Path? = null,
|
||||
isAutoSave: Boolean = true,
|
||||
isUseVfs: Boolean = true): SchemeManager<SCHEME>
|
||||
isUseVfs: ThreeState = ThreeState.UNSURE): SchemeManager<SCHEME>
|
||||
|
||||
open fun dispose(schemeManager: SchemeManager<*>) {
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.options.EmptySchemesManager
|
||||
import com.intellij.openapi.options.SchemeManager
|
||||
import com.intellij.openapi.options.SchemeManagerFactory
|
||||
import com.intellij.openapi.options.SchemeProcessor
|
||||
import com.intellij.util.ThreeState
|
||||
import java.nio.file.Path
|
||||
|
||||
private val EMPTY = EmptySchemesManager()
|
||||
@@ -21,7 +22,7 @@ class MockSchemeManagerFactory : SchemeManagerFactory() {
|
||||
streamProvider: StreamProvider?,
|
||||
directoryPath: Path?,
|
||||
isAutoSave: Boolean,
|
||||
isUseVfs: Boolean): SchemeManager<SCHEME> {
|
||||
isUseVfs: ThreeState): SchemeManager<SCHEME> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return EMPTY as SchemeManager<SCHEME>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user