mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SchemeManagerFactory — ability to pass directoryPath
This commit is contained in:
@@ -45,12 +45,13 @@ sealed class SchemeManagerFactoryBase : SchemeManagerFactory(), SettingsSavingCo
|
||||
presentableName: String?,
|
||||
roamingType: RoamingType,
|
||||
isUseOldFileNameSanitize: Boolean,
|
||||
streamProvider: StreamProvider?): SchemeManager<T> {
|
||||
streamProvider: StreamProvider?,
|
||||
directoryPath: Path?): SchemeManager<T> {
|
||||
val path = checkPath(directoryName)
|
||||
val manager = SchemeManagerImpl(path,
|
||||
processor,
|
||||
streamProvider ?: (componentManager?.stateStore?.stateStorageManager as? StateStorageManagerImpl)?.streamProvider,
|
||||
pathToFile(path),
|
||||
directoryPath ?: pathToFile(path),
|
||||
roamingType,
|
||||
presentableName,
|
||||
isUseOldFileNameSanitize,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jdom.Parent
|
||||
import java.nio.file.Path
|
||||
|
||||
@Deprecated("Please use SchemeManager")
|
||||
abstract class SchemesManager<T : Scheme> : SchemeManager<T>()
|
||||
@@ -41,8 +42,8 @@ abstract class SchemeManagerFactory {
|
||||
* directoryName — like "keymaps".
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun <SCHEME : Scheme, MUTABLE_SCHEME : SCHEME> create(directoryName: String, processor: SchemeProcessor<SCHEME, MUTABLE_SCHEME>, presentableName: String? = null): SchemeManager<SCHEME> {
|
||||
return create(directoryName, processor, presentableName, RoamingType.DEFAULT)
|
||||
fun <SCHEME : Scheme, MUTABLE_SCHEME : SCHEME> create(directoryName: String, processor: SchemeProcessor<SCHEME, MUTABLE_SCHEME>, presentableName: String? = null, directoryPath: Path? = null): SchemeManager<SCHEME> {
|
||||
return create(directoryName, processor, presentableName, RoamingType.DEFAULT, directoryPath = directoryPath)
|
||||
}
|
||||
|
||||
abstract fun <SCHEME : Scheme, MUTABLE_SCHEME : SCHEME> create(directoryName: String,
|
||||
@@ -50,7 +51,8 @@ abstract class SchemeManagerFactory {
|
||||
presentableName: String? = null,
|
||||
roamingType: RoamingType = RoamingType.DEFAULT,
|
||||
isUseOldFileNameSanitize: Boolean = false,
|
||||
streamProvider: StreamProvider? = null): SchemeManager<SCHEME>
|
||||
streamProvider: StreamProvider? = null,
|
||||
directoryPath: Path? = null): SchemeManager<SCHEME>
|
||||
}
|
||||
|
||||
enum class SchemeState {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.testFramework
|
||||
import com.intellij.configurationStore.StreamProvider
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.options.*
|
||||
import java.nio.file.Path
|
||||
|
||||
private val EMPTY = EmptySchemesManager()
|
||||
|
||||
@@ -27,7 +28,8 @@ class MockSchemeManagerFactory : SchemeManagerFactory() {
|
||||
presentableName: String?,
|
||||
roamingType: RoamingType,
|
||||
isUseOldFileNameSanitize: Boolean,
|
||||
streamProvider: StreamProvider?): SchemeManager<SCHEME> {
|
||||
streamProvider: StreamProvider?,
|
||||
directoryPath: Path?): SchemeManager<SCHEME> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return EMPTY as SchemeManager<SCHEME>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user