mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PER_USER -> DEFAULT
This commit is contained in:
@@ -171,9 +171,9 @@ open class ProjectStoreImpl(override val project: ProjectImpl, private val pathM
|
||||
|
||||
override fun getProjectFilePath() = storageManager.expandMacro(StoragePathMacros.PROJECT_FILE)
|
||||
|
||||
private fun getProjectFileStorage() = storageManager.getStateStorage(StoragePathMacros.PROJECT_FILE, RoamingType.PER_USER) as FileBasedStorage
|
||||
private fun getProjectFileStorage() = storageManager.getOrCreateStorage(StoragePathMacros.PROJECT_FILE) as FileBasedStorage
|
||||
|
||||
override fun getWorkspaceFile() = (storageManager.getStateStorage(StoragePathMacros.WORKSPACE_FILE, RoamingType.DISABLED) as FileBasedStorage?)?.getVirtualFile()
|
||||
override fun getWorkspaceFile() = (storageManager.getOrCreateStorage(StoragePathMacros.WORKSPACE_FILE, RoamingType.DISABLED) as FileBasedStorage?)?.getVirtualFile()
|
||||
|
||||
override fun getWorkspaceFilePath() = storageManager.expandMacro(StoragePathMacros.WORKSPACE_FILE)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class SchemeManagerFactoryBase : SchemesManagerFactory(), Settin
|
||||
val storageManager = (componentManager.stateStore).getStateStorageManager()
|
||||
|
||||
val path = checkPath(directoryName)
|
||||
val manager = SchemeManagerImpl<T, E>(path, processor, roamingType, (storageManager as? StateStorageManagerImpl)?.streamProvider, pathToFile(path, storageManager), componentManager)
|
||||
val manager = SchemeManagerImpl<T, E>(path, processor, (storageManager as? StateStorageManagerImpl)?.streamProvider, pathToFile(path, storageManager), roamingType, componentManager)
|
||||
@suppress("CAST_NEVER_SUCCEEDS")
|
||||
managers.add(manager as SchemeManagerImpl<Scheme, ExternalizableScheme>)
|
||||
return manager
|
||||
|
||||
@@ -55,9 +55,9 @@ import java.util.Collections
|
||||
|
||||
public class SchemeManagerImpl<T : Scheme, E : ExternalizableScheme>(private val fileSpec: String,
|
||||
private val processor: SchemeProcessor<E>,
|
||||
private val roamingType: RoamingType,
|
||||
private val provider: StreamProvider?,
|
||||
private val ioDirectory: File,
|
||||
private val roamingType: RoamingType = RoamingType.DEFAULT,
|
||||
virtualFileTrackerDisposable: Disposable? = null) : SchemesManager<T, E>(), SafeWriteRequestor {
|
||||
private val schemes = ArrayList<T>()
|
||||
private val readOnlyExternalizableSchemes = THashMap<String, E>()
|
||||
|
||||
@@ -148,7 +148,7 @@ open class StateStorageManagerImpl(private val rootTagName: String,
|
||||
*/
|
||||
open fun fileSpecToPath(fileSpec: String): String = expandMacros(fileSpec)
|
||||
|
||||
fun getOrCreateStorage(fileSpec: String, roamingType: RoamingType, storageClass: Class<out StateStorage> = javaClass<StateStorage>(), @SuppressWarnings("deprecation") stateSplitter: Class<out StateSplitter> = javaClass<StateSplitterEx>()): StateStorage {
|
||||
fun getOrCreateStorage(fileSpec: String, roamingType: RoamingType = RoamingType.DEFAULT, storageClass: Class<out StateStorage> = javaClass<StateStorage>(), @SuppressWarnings("deprecation") stateSplitter: Class<out StateSplitter> = javaClass<StateSplitterEx>()): StateStorage {
|
||||
val collapsedPath = normalizeFileSpec(fileSpec)
|
||||
val key = if (storageClass == javaClass<StateStorage>()) collapsedPath else storageClass.getName()
|
||||
storageLock.withLock {
|
||||
@@ -206,7 +206,7 @@ open class StateStorageManagerImpl(private val rootTagName: String,
|
||||
throw IllegalArgumentException("Extension is missing for storage file: $filePath")
|
||||
}
|
||||
|
||||
val effectiveRoamingType = if (roamingType == RoamingType.PER_USER && fileSpec == StoragePathMacros.WORKSPACE_FILE) RoamingType.DISABLED else roamingType
|
||||
val effectiveRoamingType = if (roamingType == RoamingType.DEFAULT && fileSpec == StoragePathMacros.WORKSPACE_FILE) RoamingType.DISABLED else roamingType
|
||||
val storage = MyFileStorage(this, File(filePath), fileSpec, rootTagName, effectiveRoamingType, getMacroSubstitutor(fileSpec), streamProvider)
|
||||
if (isUseVfsListener == ThreeState.YES) {
|
||||
virtualFileTracker?.put(filePath, storage)
|
||||
@@ -252,7 +252,7 @@ open class StateStorageManagerImpl(private val rootTagName: String,
|
||||
|
||||
override final fun rename(path: String, newName: String) {
|
||||
storageLock.withLock {
|
||||
val storage = getOrCreateStorage(collapseMacros(path), RoamingType.PER_USER) as FileBasedStorage
|
||||
val storage = getOrCreateStorage(collapseMacros(path), RoamingType.DEFAULT) as FileBasedStorage
|
||||
|
||||
val file = storage.getVirtualFile()
|
||||
try {
|
||||
@@ -391,7 +391,7 @@ open class StateStorageManagerImpl(private val rootTagName: String,
|
||||
override fun getOldStorage(component: Any, componentName: String, operation: StateStorageOperation): StateStorage? {
|
||||
val oldStorageSpec = getOldStorageSpec(component, componentName, operation) ?: return null
|
||||
@suppress("DEPRECATED_SYMBOL_WITH_MESSAGE")
|
||||
return getStateStorage(oldStorageSpec, if (component is com.intellij.openapi.util.RoamingTypeDisabled) RoamingType.DISABLED else RoamingType.PER_USER)
|
||||
return getStateStorage(oldStorageSpec, if (component is com.intellij.openapi.util.RoamingTypeDisabled) RoamingType.DISABLED else RoamingType.DEFAULT)
|
||||
}
|
||||
|
||||
protected open fun getOldStorageSpec(component: Any, componentName: String, operation: StateStorageOperation): String? = null
|
||||
|
||||
@@ -22,16 +22,16 @@ public interface StreamProvider {
|
||||
public open val enabled: Boolean
|
||||
get() = true
|
||||
|
||||
public open fun isApplicable(fileSpec: String, roamingType: RoamingType = RoamingType.PER_USER): Boolean = true
|
||||
public open fun isApplicable(fileSpec: String, roamingType: RoamingType = RoamingType.DEFAULT): Boolean = true
|
||||
|
||||
/**
|
||||
* @param fileSpec
|
||||
* @param content bytes of content, size of array is not actual size of data, you must use `size`
|
||||
* @param size actual size of data
|
||||
*/
|
||||
public fun write(fileSpec: String, content: ByteArray, size: Int = content.size(), roamingType: RoamingType = RoamingType.PER_USER)
|
||||
public fun write(fileSpec: String, content: ByteArray, size: Int = content.size(), roamingType: RoamingType = RoamingType.DEFAULT)
|
||||
|
||||
public fun read(fileSpec: String, roamingType: RoamingType = RoamingType.PER_USER): InputStream?
|
||||
public fun read(fileSpec: String, roamingType: RoamingType = RoamingType.DEFAULT): InputStream?
|
||||
|
||||
/**
|
||||
* You must close passed input stream.
|
||||
@@ -41,7 +41,7 @@ public interface StreamProvider {
|
||||
/**
|
||||
* Delete file or directory
|
||||
*/
|
||||
public fun delete(fileSpec: String, roamingType: RoamingType = RoamingType.PER_USER)
|
||||
public fun delete(fileSpec: String, roamingType: RoamingType = RoamingType.DEFAULT)
|
||||
}
|
||||
|
||||
public fun StreamProvider.write(fileSpec: String, content: String) {
|
||||
|
||||
@@ -18,7 +18,9 @@ package com.intellij.configurationStore
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.components.StateStorage
|
||||
import com.intellij.openapi.components.TrackingPathMacroSubstitutor
|
||||
import com.intellij.openapi.components.impl.stores.*
|
||||
import com.intellij.openapi.components.impl.stores.FileStorageCoreUtil
|
||||
import com.intellij.openapi.components.impl.stores.StateStorageBase
|
||||
import com.intellij.openapi.components.impl.stores.StorageUtil
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.containers.SmartHashSet
|
||||
@@ -30,9 +32,9 @@ import java.io.IOException
|
||||
abstract class XmlElementStorage protected constructor(protected val fileSpec: String,
|
||||
protected val rootElementName: String,
|
||||
protected val pathMacroSubstitutor: TrackingPathMacroSubstitutor?,
|
||||
roamingType: RoamingType?,
|
||||
provider: StreamProvider?) : StateStorageBase<StateMap>() {
|
||||
protected val roamingType: RoamingType = roamingType ?: RoamingType.PER_USER
|
||||
roamingType: RoamingType? = RoamingType.DEFAULT,
|
||||
provider: StreamProvider? = null) : StateStorageBase<StateMap>() {
|
||||
protected val roamingType: RoamingType = roamingType ?: RoamingType.DEFAULT
|
||||
private val provider: StreamProvider? = if (provider == null || roamingType == RoamingType.DISABLED || !provider.isApplicable(fileSpec, this.roamingType)) null else provider
|
||||
|
||||
protected abstract fun loadLocalData(): Element?
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public final class DefaultStorageAnnotation implements Storage {
|
||||
|
||||
@Override
|
||||
public RoamingType roamingType() {
|
||||
return RoamingType.PER_USER;
|
||||
return RoamingType.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ class ApplicationStoreTest {
|
||||
component.foo = "newValue"
|
||||
componentStore.save(SmartList())
|
||||
|
||||
assertThat(streamProvider.data.get(RoamingType.PER_USER)!!.get("proxy.settings.xml")).isEqualTo("<application>\n" + " <component name=\"HttpConfigurable\">\n" + " <option name=\"foo\" value=\"newValue\" />\n" + " </component>\n" + "</application>")
|
||||
assertThat(streamProvider.data.get(RoamingType.DEFAULT)!!.get("proxy.settings.xml")).isEqualTo("<application>\n" + " <component name=\"HttpConfigurable\">\n" + " <option name=\"foo\" value=\"newValue\" />\n" + " </component>\n" + "</application>")
|
||||
}
|
||||
|
||||
@Test fun testLoadFromStreamProvider() {
|
||||
@@ -73,7 +73,7 @@ class ApplicationStoreTest {
|
||||
val map = THashMap<String, String>()
|
||||
val fileSpec = "proxy.settings.xml"
|
||||
map.put(fileSpec, "<application>\n <component name=\"HttpConfigurable\">\n <option name=\"foo\" value=\"newValue\" />\n </component>\n</application>")
|
||||
streamProvider.data.put(RoamingType.PER_USER, map)
|
||||
streamProvider.data.put(RoamingType.DEFAULT, map)
|
||||
|
||||
componentStore.storageManager.streamProvider = streamProvider
|
||||
componentStore.initComponent(component, false)
|
||||
|
||||
@@ -19,7 +19,7 @@ class MockStreamProvider(private val myBaseDir: File) : StreamProvider {
|
||||
}
|
||||
|
||||
private fun listSubFiles(fileSpec: String, roamingType: RoamingType): Collection<String> {
|
||||
if (roamingType !== RoamingType.PER_USER) {
|
||||
if (roamingType !== RoamingType.DEFAULT) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class ModuleStoreRenameTest {
|
||||
// project structure
|
||||
@Test fun `rename module using model`() {
|
||||
runInEdtAndWait { module.saveStore() }
|
||||
val storage = module.stateStore.getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.PER_USER) as FileBasedStorage
|
||||
val storage = module.stateStore.getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.DEFAULT) as FileBasedStorage
|
||||
val oldFile = storage.file
|
||||
assertThat(oldFile).isFile()
|
||||
|
||||
@@ -97,7 +97,7 @@ class ModuleStoreRenameTest {
|
||||
// project view
|
||||
@Test fun `rename module using rename virtual file`() {
|
||||
runInEdtAndWait { module.saveStore() }
|
||||
var storage = module.stateStore.getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.PER_USER) as FileBasedStorage
|
||||
var storage = module.stateStore.getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.DEFAULT) as FileBasedStorage
|
||||
val oldFile = storage.file
|
||||
assertThat(oldFile).isFile()
|
||||
|
||||
@@ -112,7 +112,7 @@ class ModuleStoreRenameTest {
|
||||
|
||||
private fun assertRename(newName: String, oldFile: File) {
|
||||
val storageManager = module.stateStore.getStateStorageManager()
|
||||
val newFile = (storageManager.getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.PER_USER) as FileBasedStorage).file
|
||||
val newFile = (storageManager.getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.DEFAULT) as FileBasedStorage).file
|
||||
assertThat(newFile.getName()).isEqualTo("$newName${ModuleFileType.DOT_DEFAULT_EXTENSION}")
|
||||
assertThat(oldFile)
|
||||
.doesNotExist()
|
||||
@@ -126,7 +126,7 @@ class ModuleStoreRenameTest {
|
||||
@Test fun `rename module parent virtual dir`() {
|
||||
runInEdtAndWait { module.saveStore() }
|
||||
val storageManager = module.stateStore.getStateStorageManager()
|
||||
val storage = storageManager.getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.PER_USER) as FileBasedStorage
|
||||
val storage = storageManager.getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.DEFAULT) as FileBasedStorage
|
||||
|
||||
val oldFile = storage.file
|
||||
val parentVirtualDir = storage.getVirtualFile()!!.getParent()
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.options.BaseSchemeProcessor
|
||||
import com.intellij.openapi.options.ExternalizableScheme
|
||||
import com.intellij.openapi.options.SchemesManagerFactory
|
||||
@@ -158,7 +157,7 @@ class SchemeManagerTest {
|
||||
override fun isUpgradeNeeded() = true
|
||||
|
||||
override fun getSchemeExtension() = ".icls"
|
||||
}, RoamingType.PER_USER, null, dir)
|
||||
}, null, dir)
|
||||
schemesManager.loadSchemes()
|
||||
assertThat(schemesManager.getAllSchemes()).containsOnly(scheme)
|
||||
|
||||
@@ -305,7 +304,7 @@ class SchemeManagerTest {
|
||||
assertThatThrownBy({SchemesManagerFactory.getInstance().create<TestScheme, TestScheme>("foo\\bar", TestSchemesProcessor())}).hasMessage("Path must be system-independent, use forward slash instead of backslash")
|
||||
}
|
||||
|
||||
private fun createSchemeManager(dir: File) = SchemeManagerImpl<TestScheme, TestScheme>(FILE_SPEC, TestSchemesProcessor(), RoamingType.PER_USER, null, dir)
|
||||
private fun createSchemeManager(dir: File) = SchemeManagerImpl<TestScheme, TestScheme>(FILE_SPEC, TestSchemesProcessor(), null, dir)
|
||||
|
||||
private fun createAndLoad(testData: String): SchemeManagerImpl<TestScheme, TestScheme> {
|
||||
createTempFiles(testData)
|
||||
@@ -325,7 +324,7 @@ class SchemeManagerTest {
|
||||
}
|
||||
|
||||
private fun createAndLoad(): SchemeManagerImpl<TestScheme, TestScheme> {
|
||||
val schemesManager = SchemeManagerImpl<TestScheme, TestScheme>(FILE_SPEC, TestSchemesProcessor(), RoamingType.PER_USER, MockStreamProvider(remoteBaseDir!!), localBaseDir!!)
|
||||
val schemesManager = SchemeManagerImpl<TestScheme, TestScheme>(FILE_SPEC, TestSchemesProcessor(), MockStreamProvider(remoteBaseDir!!), localBaseDir!!)
|
||||
schemesManager.loadSchemes()
|
||||
return schemesManager
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.configurationStore
|
||||
|
||||
import com.intellij.openapi.components.ComponentManager
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.components.stateStore
|
||||
import com.intellij.testFramework.ProjectRule
|
||||
import com.intellij.util.SmartList
|
||||
@@ -43,7 +42,7 @@ class StorageManagerTest {
|
||||
}
|
||||
|
||||
public Test fun createFileStateStorageMacroSubstituted() {
|
||||
assertThat(storageManager.getStateStorage("$MACRO/test.xml", RoamingType.PER_USER)).isNotNull()
|
||||
assertThat(storageManager.getOrCreateStorage("$MACRO/test.xml")).isNotNull()
|
||||
}
|
||||
|
||||
public Test fun `collapse macro`() {
|
||||
@@ -59,7 +58,7 @@ class StorageManagerTest {
|
||||
|
||||
public Test fun `create storage assertion thrown when unknown macro`() {
|
||||
try {
|
||||
storageManager.getStateStorage("\$UNKNOWN_MACRO$/test.xml", RoamingType.PER_USER)
|
||||
storageManager.getOrCreateStorage("\$UNKNOWN_MACRO$/test.xml")
|
||||
TestCase.fail("Exception expected")
|
||||
}
|
||||
catch (e: IllegalArgumentException) {
|
||||
@@ -69,7 +68,7 @@ class StorageManagerTest {
|
||||
|
||||
public Test fun `create file storage macro substituted when expansion has$`() {
|
||||
storageManager.addMacro("\$DOLLAR_MACRO$", "/temp/d$")
|
||||
assertThat(storageManager.getStateStorage("\$DOLLAR_MACRO$/test.xml", RoamingType.PER_USER)).isNotNull()
|
||||
assertThat(storageManager.getOrCreateStorage("\$DOLLAR_MACRO$/test.xml")).isNotNull()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ public enum RoamingType {
|
||||
/**
|
||||
* Default, shared.
|
||||
*/
|
||||
PER_USER,
|
||||
DEFAULT,
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* Use {@link #PER_USER} instead
|
||||
* Use {@link #DEFAULT} instead
|
||||
*/
|
||||
GLOBAL,
|
||||
PER_USER,
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class SchemesManagerFactory {
|
||||
|
||||
@NotNull
|
||||
public final <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> create(@NotNull String directoryName, @NotNull SchemeProcessor<E> processor) {
|
||||
return createSchemesManager(directoryName, processor, RoamingType.PER_USER);
|
||||
return createSchemesManager(directoryName, processor, RoamingType.DEFAULT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -184,7 +184,7 @@ public class TemplateSettings implements PersistentStateComponent<TemplateSettin
|
||||
private TemplateKey myLastSelectedTemplate;
|
||||
|
||||
public TemplateSettings(SchemesManagerFactory schemesManagerFactory) {
|
||||
mySchemesManager = schemesManagerFactory.createSchemesManager(TEMPLATES_DIR_PATH, new BaseSchemeProcessor<TemplateGroup>() {
|
||||
mySchemesManager = schemesManagerFactory.create(TEMPLATES_DIR_PATH, new BaseSchemeProcessor<TemplateGroup>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public TemplateGroup readScheme(@NotNull Element element) throws InvalidDataException {
|
||||
@@ -239,7 +239,7 @@ public class TemplateSettings implements PersistentStateComponent<TemplateSettin
|
||||
removeTemplate(template);
|
||||
}
|
||||
}
|
||||
}, RoamingType.PER_USER);
|
||||
});
|
||||
|
||||
for (TemplateGroup group : mySchemesManager.loadSchemes()) {
|
||||
for (TemplateImpl template : group.getElements()) {
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple
|
||||
myRegistrar = registrar;
|
||||
registerProvidedSeverities();
|
||||
|
||||
mySchemesManager = schemesManagerFactory.createSchemesManager(INSPECTION_DIR, new BaseSchemeProcessor<InspectionProfileImpl>() {
|
||||
mySchemesManager = schemesManagerFactory.create(INSPECTION_DIR, new BaseSchemeProcessor<InspectionProfileImpl>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public InspectionProfileImpl readScheme(@NotNull Element element) {
|
||||
@@ -139,7 +139,7 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple
|
||||
}
|
||||
onProfilesChanged();
|
||||
}
|
||||
}, RoamingType.PER_USER);
|
||||
});
|
||||
mySeverityRegistrar = new SeverityRegistrar(messageBus);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx
|
||||
|
||||
@NotNull
|
||||
private static FileStorage getMainStorage(@NotNull Module module) {
|
||||
return (FileStorage)ComponentsPackage.getStateStore(module).getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.PER_USER);
|
||||
return (FileStorage)ComponentsPackage.getStateStore(module).getStateStorageManager().getStateStorage(StoragePathMacros.MODULE_FILE, RoamingType.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-3
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.codeStyle;
|
||||
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
import com.intellij.openapi.options.BaseSchemeProcessor;
|
||||
import com.intellij.openapi.options.SchemesManager;
|
||||
import com.intellij.openapi.options.SchemesManagerFactory;
|
||||
@@ -39,7 +38,7 @@ public abstract class CodeStyleSchemesImpl extends CodeStyleSchemes {
|
||||
protected final SchemesManager<CodeStyleScheme, CodeStyleSchemeImpl> mySchemesManager;
|
||||
|
||||
public CodeStyleSchemesImpl(@NotNull SchemesManagerFactory schemesManagerFactory) {
|
||||
mySchemesManager = schemesManagerFactory.createSchemesManager(CODE_STYLES_DIR_PATH, new BaseSchemeProcessor<CodeStyleSchemeImpl>() {
|
||||
mySchemesManager = schemesManagerFactory.create(CODE_STYLES_DIR_PATH, new BaseSchemeProcessor<CodeStyleSchemeImpl>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public CodeStyleSchemeImpl readScheme(@NotNull Element element) {
|
||||
@@ -64,7 +63,7 @@ public abstract class CodeStyleSchemesImpl extends CodeStyleSchemes {
|
||||
public void initScheme(@NotNull CodeStyleSchemeImpl scheme) {
|
||||
scheme.init(CodeStyleSchemesImpl.this);
|
||||
}
|
||||
}, RoamingType.PER_USER);
|
||||
});
|
||||
|
||||
mySchemesManager.loadSchemes();
|
||||
addScheme(new CodeStyleSchemeImpl(DEFAULT_SCHEME_NAME, true, null));
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.tools;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.components.ExportableComponent;
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
import com.intellij.openapi.options.SchemeProcessor;
|
||||
import com.intellij.openapi.options.SchemesManager;
|
||||
import com.intellij.openapi.options.SchemesManagerFactory;
|
||||
@@ -40,7 +39,7 @@ public abstract class BaseToolManager<T extends Tool> implements ExportableCompo
|
||||
public BaseToolManager(@NotNull ActionManagerEx actionManagerEx, SchemesManagerFactory factory) {
|
||||
myActionManager = actionManagerEx;
|
||||
|
||||
mySchemesManager = factory.createSchemesManager(getSchemesPath(), createProcessor(), RoamingType.PER_USER);
|
||||
mySchemesManager = factory.create(getSchemesPath(), createProcessor());
|
||||
mySchemesManager.loadSchemes();
|
||||
registerActions();
|
||||
}
|
||||
|
||||
+14
-16
@@ -21,7 +21,6 @@ import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.BundledQuickListsProvider;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ExportableApplicationComponent;
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
import com.intellij.openapi.options.BaseSchemeProcessor;
|
||||
import com.intellij.openapi.options.SchemesManager;
|
||||
import com.intellij.openapi.options.SchemesManagerFactory;
|
||||
@@ -44,22 +43,21 @@ public class QuickListsManager implements ExportableApplicationComponent {
|
||||
|
||||
public QuickListsManager(@NotNull ActionManager actionManager, @NotNull SchemesManagerFactory schemesManagerFactory) {
|
||||
myActionManager = actionManager;
|
||||
mySchemeManager = schemesManagerFactory.createSchemesManager("quicklists",
|
||||
new BaseSchemeProcessor<QuickList>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public QuickList readScheme(@NotNull Element element) {
|
||||
return createItem(element);
|
||||
}
|
||||
mySchemeManager = schemesManagerFactory.create("quicklists",
|
||||
new BaseSchemeProcessor<QuickList>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public QuickList readScheme(@NotNull Element element) {
|
||||
return createItem(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element writeScheme(@NotNull QuickList scheme) {
|
||||
Element element = new Element(LIST_TAG);
|
||||
scheme.writeExternal(element);
|
||||
return element;
|
||||
}
|
||||
},
|
||||
RoamingType.PER_USER);
|
||||
@Override
|
||||
public Element writeScheme(@NotNull QuickList scheme) {
|
||||
Element element = new Element(LIST_TAG);
|
||||
scheme.writeExternal(element);
|
||||
return element;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
-3
@@ -20,7 +20,10 @@ import com.intellij.ide.WelcomeWizardUtil;
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.components.StoragePathMacros;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsListener;
|
||||
@@ -75,7 +78,7 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
|
||||
public EditorColorsManagerImpl(@NotNull DefaultColorSchemesManager defaultColorSchemeManager, @NotNull SchemesManagerFactory schemeManagerFactory) {
|
||||
myDefaultColorSchemeManager = defaultColorSchemeManager;
|
||||
|
||||
mySchemeManager = schemeManagerFactory.createSchemesManager(FILE_SPEC, new BaseSchemeProcessor<EditorColorsSchemeImpl>() {
|
||||
mySchemeManager = schemeManagerFactory.create(FILE_SPEC, new BaseSchemeProcessor<EditorColorsSchemeImpl>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorColorsSchemeImpl readScheme(@NotNull Element element) {
|
||||
@@ -122,7 +125,7 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
|
||||
public boolean isUpgradeNeeded() {
|
||||
return true;
|
||||
}
|
||||
}, RoamingType.PER_USER);
|
||||
});
|
||||
|
||||
initDefaultSchemes();
|
||||
loadBundledSchemes();
|
||||
|
||||
+2
-2
@@ -143,7 +143,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
|
||||
autoDetectedAttribute = new FileAttribute("AUTO_DETECTION_CACHE_ATTRIBUTE", fileTypeChangedCounter, true);
|
||||
|
||||
myMessageBus = bus;
|
||||
mySchemesManager = schemesManagerFactory.createSchemesManager(FILE_SPEC, new BaseSchemeProcessor<AbstractFileType>() {
|
||||
mySchemesManager = schemesManagerFactory.create(FILE_SPEC, new BaseSchemeProcessor<AbstractFileType>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public AbstractFileType readScheme(@NotNull Element element, boolean duringLoad) {
|
||||
@@ -196,7 +196,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
|
||||
myPatternsTable.removeAllAssociations(scheme);
|
||||
fireFileTypesChanged();
|
||||
}
|
||||
}, RoamingType.PER_USER);
|
||||
});
|
||||
bus.connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class KeymapManagerImpl extends KeymapManagerEx implements PersistentStat
|
||||
}
|
||||
}
|
||||
};
|
||||
mySchemesManager = factory.createSchemesManager(KEYMAPS_DIR_PATH, schemeProcessor, RoamingType.PER_USER);
|
||||
mySchemesManager = factory.create(KEYMAPS_DIR_PATH, schemeProcessor);
|
||||
|
||||
String systemDefaultKeymap = WelcomeWizardUtil.getWizardMacKeymap() != null
|
||||
? WelcomeWizardUtil.getWizardMacKeymap()
|
||||
|
||||
@@ -37,7 +37,7 @@ public @interface Storage {
|
||||
/**
|
||||
* You must not store components with different roaming types in one file ({@link #file()}).
|
||||
*/
|
||||
RoamingType roamingType() default RoamingType.PER_USER;
|
||||
RoamingType roamingType() default RoamingType.DEFAULT;
|
||||
|
||||
/**
|
||||
* Class must have constructor (ComponentManager componentManager, StateStorageManager storageManager). componentManager parameter can have more concrete type - e.g. Module (if storage intended to support only one type)
|
||||
|
||||
@@ -81,5 +81,5 @@ private fun getRoamingType(components: Collection<ExportableComponent>): Roaming
|
||||
}
|
||||
}
|
||||
}
|
||||
return RoamingType.PER_USER
|
||||
return RoamingType.DEFAULT
|
||||
}
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.settingsRepository;
|
||||
|
||||
import com.intellij.openapi.components.ComponentsPackage;
|
||||
@@ -57,7 +72,7 @@ public class CommitToIcsDialog extends DialogWrapper {
|
||||
VirtualFile file = change.getVirtualFile();
|
||||
assert file != null;
|
||||
String fileSpec = macroSubstitutor.collapsePath(file.getPath());
|
||||
String repoPath = SettingsRepositoryPackage.buildPath(fileSpec, RoamingType.PER_USER, projectId);
|
||||
String repoPath = SettingsRepositoryPackage.buildPath(fileSpec, RoamingType.DEFAULT, projectId);
|
||||
addToIcs.add(repoPath);
|
||||
if (!icsManager.getRepositoryManager().has(repoPath)) {
|
||||
// new, revert local
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.jetbrains.settingsRepository.test
|
||||
|
||||
import com.intellij.configurationStore.write
|
||||
import com.intellij.mock.MockVirtualFileSystem
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vcs.merge.MergeSession
|
||||
import com.intellij.openapi.vfs.CharsetToolkit
|
||||
@@ -125,7 +124,7 @@ class GitTest : IcsTestCase() {
|
||||
val dir = "dir"
|
||||
val fullFileSpec = "$dir/file.xml"
|
||||
provider.write(fullFileSpec, SAMPLE_FILE_CONTENT)
|
||||
provider.delete(if (directory) dir else fullFileSpec, RoamingType.PER_USER)
|
||||
provider.delete(if (directory) dir else fullFileSpec)
|
||||
|
||||
val diff = repository.computeIndexDiff()
|
||||
assertThat(diff.diff()).isFalse()
|
||||
@@ -295,7 +294,7 @@ class GitTest : IcsTestCase() {
|
||||
|
||||
sync(SyncType.MERGE)
|
||||
|
||||
provider.delete("remote.xml", RoamingType.PER_USER)
|
||||
provider.delete("remote.xml")
|
||||
repositoryManager.commit()
|
||||
|
||||
remoteRepository.writePath("remote.xml", AM.MARKER_ACCEPT_THEIRS)
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.settingsRepository.test
|
||||
import com.intellij.configurationStore.SchemeManagerImpl
|
||||
import com.intellij.configurationStore.TestScheme
|
||||
import com.intellij.configurationStore.TestSchemesProcessor
|
||||
import com.intellij.openapi.components.RoamingType
|
||||
import com.intellij.testFramework.ProjectRule
|
||||
import com.intellij.util.xmlb.serialize
|
||||
import com.intellij.util.xmlb.toByteArray
|
||||
@@ -38,7 +37,7 @@ class LoadTest : IcsTestCase() {
|
||||
|
||||
private val dirPath = "\$ROOT_CONFIG$/keymaps"
|
||||
|
||||
private fun createSchemeManager(dirPath: String) = SchemeManagerImpl<TestScheme, TestScheme>(dirPath, TestSchemesProcessor(), RoamingType.PER_USER, provider, tempDirManager.newDirectory("schemes"))
|
||||
private fun createSchemeManager(dirPath: String) = SchemeManagerImpl<TestScheme, TestScheme>(dirPath, TestSchemesProcessor(), provider, tempDirManager.newDirectory("schemes"))
|
||||
|
||||
@Test fun `load scheme`() {
|
||||
val localScheme = TestScheme("local")
|
||||
|
||||
Reference in New Issue
Block a user