diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java index 4d8bd26f32ee..6dbe74da781d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java @@ -139,7 +139,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements @Override public Element getState() { - final boolean savingStateInNewFormatAllowed = Registry.is("saving.state.in.new.format.is.allowed", false); + final boolean savingStateInNewFormatAllowed = Registry.is("saving.state.in.new.format.is.allowed", true); Element state = new Element("state"); XmlSerializer.serializeInto(myState, state, new SkipDefaultValuesSerializationFilters() { diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelProjectExtensionImpl.java b/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelProjectExtensionImpl.java index 76ef138fa2da..21f6ebcaa1c1 100644 --- a/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelProjectExtensionImpl.java +++ b/java/java-impl/src/com/intellij/openapi/roots/impl/LanguageLevelProjectExtensionImpl.java @@ -54,7 +54,7 @@ public class LanguageLevelProjectExtensionImpl extends LanguageLevelProjectExten private void readExternal(final Element element) { String level = element.getAttributeValue(LANGUAGE_LEVEL); if (level == null) { - myLanguageLevel = Registry.is("saving.state.in.new.format.is.allowed", false) ? null : migrateFromIdea7(element); + myLanguageLevel = Registry.is("saving.state.in.new.format.is.allowed", true) ? null : migrateFromIdea7(element); } else { myLanguageLevel = LanguageLevel.valueOf(level); @@ -86,7 +86,7 @@ public class LanguageLevelProjectExtensionImpl extends LanguageLevelProjectExten element.setAttribute(DEFAULT_ATTRIBUTE, Boolean.toString(aBoolean)); } - if (!Registry.is("saving.state.in.new.format.is.allowed", false)) { + if (!Registry.is("saving.state.in.new.format.is.allowed", true)) { writeAttributesForIdea7(element); } } diff --git a/java/java-tests/java-tests.iml b/java/java-tests/java-tests.iml index 8636261ec258..1f39eba6946c 100644 --- a/java/java-tests/java-tests.iml +++ b/java/java-tests/java-tests.iml @@ -55,5 +55,6 @@ + \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ex/ProjectInspectionManagerTest.kt b/java/java-tests/testSrc/com/intellij/codeInspection/ex/ProjectInspectionManagerTest.kt new file mode 100644 index 000000000000..4a252691d598 --- /dev/null +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ex/ProjectInspectionManagerTest.kt @@ -0,0 +1,123 @@ +/* + * Copyright 2000-2016 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 com.intellij.codeInspection.ex + +import com.intellij.configurationStore.PROJECT_CONFIG_DIR +import com.intellij.configurationStore.StoreAwareProjectManager +import com.intellij.configurationStore.loadAndUseProject +import com.intellij.configurationStore.saveStore +import com.intellij.openapi.components.stateStore +import com.intellij.openapi.project.ProjectManager +import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl +import com.intellij.testFramework.Assertions.assertThat +import com.intellij.testFramework.ProjectRule +import com.intellij.testFramework.RuleChain +import com.intellij.testFramework.TemporaryDirectory +import com.intellij.util.delete +import com.intellij.util.readText +import com.intellij.util.write +import org.junit.ClassRule +import org.junit.Rule +import org.junit.Test +import java.nio.file.Paths + +internal class ProjectInspectionManagerTest { + companion object { + @JvmField + @ClassRule + val projectRule = ProjectRule() + } + + val tempDirManager = TemporaryDirectory() + + private val ruleChain = RuleChain(tempDirManager) + @Rule fun getChain() = ruleChain + + @Test fun `component`() { + loadAndUseProject(tempDirManager, { + it.path + }) { project -> + val projectInspectionProfileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project) + + assertThat(projectInspectionProfileManager.state).isEmpty() + + projectInspectionProfileManager.currentProfile + + assertThat(projectInspectionProfileManager.state).isEmpty() + + // cause to use app profile + projectInspectionProfileManager.setRootProfile(null) + val doNotUseProjectProfileState = """ + + """.trimIndent() + assertThat(projectInspectionProfileManager.state).isEqualTo(doNotUseProjectProfileState) + + val inspectionDir = Paths.get(project.stateStore.stateStorageManager.expandMacros(PROJECT_CONFIG_DIR), "inspectionProfiles") + val file = inspectionDir.resolve("profiles_settings.xml") + project.saveStore() + assertThat(file).exists() + val doNotUseProjectProfileData = """ + + """.trimIndent() + assertThat(file.readText()).isEqualTo(doNotUseProjectProfileData) + + // test load + file.delete() + + project.baseDir.refresh(false, true) + (ProjectManager.getInstance() as StoreAwareProjectManager).flushChangedAlarm() + assertThat(projectInspectionProfileManager.state).isEmpty() + + file.write(doNotUseProjectProfileData) + project.baseDir.refresh(false, true) + (ProjectManager.getInstance() as StoreAwareProjectManager).flushChangedAlarm() + assertThat(projectInspectionProfileManager.state).isEqualTo(doNotUseProjectProfileState) + } + } + + @Test fun `profiles`() { + loadAndUseProject(tempDirManager, { + it.path + }) { project -> + val projectInspectionProfileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project) + + assertThat(projectInspectionProfileManager.state).isEmpty() + + // cause to use app profile + val currentProfile = projectInspectionProfileManager.currentProfile + assertThat(currentProfile.isProjectLevel).isTrue() + InspectionProfileImpl.initAndDo { + currentProfile.disableTool("Convert2Diamond", project) + } + + project.saveStore() + + val inspectionDir = Paths.get(project.stateStore.stateStorageManager.expandMacros(PROJECT_CONFIG_DIR), "inspectionProfiles") + val file = inspectionDir.resolve("profiles_settings.xml") + + assertThat(file).doesNotExist() + assertThat(inspectionDir.resolve("Project_Default.xml").readText()).isEqualTo(""" + + """.trimIndent()) + } + } +} \ No newline at end of file diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java index d4b94d3db6ac..e4125584eaa0 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java @@ -104,7 +104,7 @@ public class AnnotationProcessorProfileSerializer { public static void writeExternal(@NotNull ProcessorConfigProfile profile, @NotNull Element element) { element.setAttribute(NAME, profile.getName()); - if (!Registry.is("saving.state.in.new.format.is.allowed", false) || profile.isEnabled()) { + if (!Registry.is("saving.state.in.new.format.is.allowed", true) || profile.isEnabled()) { element.setAttribute(ENABLED, Boolean.toString(profile.isEnabled())); } @@ -141,7 +141,7 @@ public class AnnotationProcessorProfileSerializer { Element pathElement = null; - if (!Registry.is("saving.state.in.new.format.is.allowed", false) || !profile.isObtainProcessorsFromClasspath()) { + if (!Registry.is("saving.state.in.new.format.is.allowed", true) || !profile.isObtainProcessorsFromClasspath()) { pathElement = addChild(element, "processorPath"); pathElement.setAttribute("useClasspath", Boolean.toString(profile.isObtainProcessorsFromClasspath())); } diff --git a/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java b/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java index 187350f69e36..77f4e2fbd859 100644 --- a/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/ex/ScopeToolState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -64,7 +64,7 @@ public class ScopeToolState { } @Nullable - public NamedScope getScope(Project project) { + public NamedScope getScope(@Nullable Project project) { if (myScope == null && project != null) { myScope = NamedScopesHolder.getScope(project, myScopeName); } diff --git a/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopesHolder.java b/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopesHolder.java index af943460bbe4..4b94254b636a 100644 --- a/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopesHolder.java +++ b/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/NamedScopesHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -102,8 +102,7 @@ public abstract class NamedScopesHolder implements PersistentStateComponent toolIds, Project project) { + public void disableToolByDefault(@NotNull List toolIds, @Nullable Project project) { for (final String toolId : toolIds) { getToolDefaultState(toolId, project).setEnabled(false); } } @NotNull - public ScopeToolState getToolDefaultState(@NotNull String toolId, Project project) { + public ScopeToolState getToolDefaultState(@NotNull String toolId, @Nullable Project project) { return getTools(toolId, project).getDefaultState(); } @@ -612,7 +612,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, HighlightDisplayKey key = HighlightDisplayKey.find(shortName); if (key == null) { final InspectionEP extension = toolWrapper.getExtension(); - Computable computable = extension == null ? new Computable.PredefinedValueComputable(toolWrapper.getDisplayName()) : (Computable)extension::getDisplayName; + Computable computable = extension == null ? new Computable.PredefinedValueComputable(toolWrapper.getDisplayName()) : extension::getDisplayName; if (toolWrapper instanceof LocalInspectionToolWrapper) { key = HighlightDisplayKey.register(shortName, computable, toolWrapper.getID(), ((LocalInspectionToolWrapper)toolWrapper).getAlternativeID()); @@ -667,14 +667,14 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, } @NotNull - private List createTools(Project project) { + private List createTools(@Nullable Project project) { if (mySource != null) { return ContainerUtil.map(mySource.getDefaultStates(project), ScopeToolState::getTool); } return myRegistrar.createTools(); } - private HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey key, Project project) { + private HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey key, @Nullable Project project) { final ToolsImpl tools = getTools(key.toString(), project); LOG.assertTrue(tools != null, "profile name: " + myName + " base profile: " + (myBaseProfile != null ? myBaseProfile.getName() : "-") + " key: " + key); return tools.getLevel(); @@ -896,7 +896,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, } @NotNull - public List getDefaultStates(Project project) { + public List getDefaultStates(@Nullable Project project) { initInspectionTools(project); final List result = new ArrayList<>(); for (Tools tools : myTools.values()) { diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt index 2cff9fa5d7b4..56a347ca28ee 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt @@ -94,7 +94,7 @@ class ProjectInspectionProfileManagerImpl(val project: Project, profile.isProjectLevel = true return profile } - }) + }, isUseOldFileNameSanitize = true) project.messageBus.connect().subscribe(ProjectManager.TOPIC, object: ProjectManagerListener { override fun projectClosed(project: Project) { diff --git a/platform/configuration-store-impl/src/DirectoryBasedStorage.kt b/platform/configuration-store-impl/src/DirectoryBasedStorage.kt index 81b09e8d6281..d8d2531a487b 100644 --- a/platform/configuration-store-impl/src/DirectoryBasedStorage.kt +++ b/platform/configuration-store-impl/src/DirectoryBasedStorage.kt @@ -23,16 +23,11 @@ import com.intellij.openapi.components.TrackingPathMacroSubstitutor import com.intellij.openapi.components.impl.stores.DirectoryStorageUtil import com.intellij.openapi.components.impl.stores.FileStorageCoreUtil import com.intellij.openapi.components.impl.stores.StateStorageBase -import com.intellij.openapi.util.JDOMUtil import com.intellij.openapi.util.Pair -import com.intellij.openapi.vfs.CharsetToolkit import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.VirtualFile -import com.intellij.util.LineSeparator -import com.intellij.util.SmartList -import com.intellij.util.SystemProperties +import com.intellij.util.* import com.intellij.util.containers.SmartHashSet -import com.intellij.util.systemIndependentPath import gnu.trove.THashMap import org.jdom.Element import java.io.IOException @@ -119,7 +114,7 @@ open class DirectoryBasedStorage(private val dir: Path, override fun setSerializedState(componentName: String, element: Element?) { storage.componentName = componentName - if (JDOMUtil.isEmpty(element)) { + if (element.isEmpty()) { if (copiedStorageData != null) { copiedStorageData!!.clear() } @@ -254,9 +249,6 @@ private fun loadFile(file: VirtualFile?): Pair { } val bytes = file.contentsToByteArray() - var lineSeparator: String? = file.detectedLineSeparator - if (lineSeparator == null) { - lineSeparator = detectLineSeparators(CharsetToolkit.UTF8_CHARSET.decode(ByteBuffer.wrap(bytes)), null).separatorString - } + val lineSeparator = file.detectedLineSeparator ?: detectLineSeparators(Charsets.UTF_8.decode(ByteBuffer.wrap(bytes)), null).separatorString return Pair.create(bytes, lineSeparator) } \ No newline at end of file diff --git a/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt b/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt index 9ce81c430ae9..f6d46bbf6603 100644 --- a/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt +++ b/platform/configuration-store-impl/src/SchemeManagerFactoryImpl.kt @@ -40,10 +40,10 @@ sealed class SchemeManagerFactoryBase : SchemeManagerFactory(), SettingsSavingCo protected open val componentManager: ComponentManager? = null - override final fun create(directoryName: String, processor: SchemeProcessor, presentableName: String?, roamingType: RoamingType): SchemeManager { + override final fun create(directoryName: String, processor: SchemeProcessor, presentableName: String?, roamingType: RoamingType, isUseOldFileNameSanitize: Boolean): SchemeManager { val path = checkPath(directoryName) - val manager = SchemeManagerImpl(path, processor, (componentManager?.stateStore?.stateStorageManager as? StateStorageManagerImpl)?.streamProvider, pathToFile(path), roamingType, componentManager, presentableName) - @Suppress("CAST_NEVER_SUCCEEDS") + val manager = SchemeManagerImpl(path, processor, (componentManager?.stateStore?.stateStorageManager as? StateStorageManagerImpl)?.streamProvider, pathToFile(path), roamingType, componentManager, presentableName, isUseOldFileNameSanitize) + @Suppress("UNCHECKED_CAST") managers.add(manager as SchemeManagerImpl) return manager } @@ -103,18 +103,18 @@ sealed class SchemeManagerFactoryBase : SchemeManagerFactory(), SettingsSavingCo return path } - override fun pathToFile(path: String) = Paths.get(ApplicationManager.getApplication().stateStore.stateStorageManager.expandMacros(ROOT_CONFIG), path) + override fun pathToFile(path: String) = Paths.get(ApplicationManager.getApplication().stateStore.stateStorageManager.expandMacros(ROOT_CONFIG), path)!! } @Suppress("unused") private class ProjectSchemeManagerFactory(private val project: Project) : SchemeManagerFactoryBase() { override val componentManager = project - override fun pathToFile(path: String) = Paths.get(project.basePath, if (ProjectUtil.isDirectoryBased(project)) "${Project.DIRECTORY_STORE_FOLDER}/$path" else ".$path") + override fun pathToFile(path: String) = Paths.get(project.basePath, if (ProjectUtil.isDirectoryBased(project)) "${Project.DIRECTORY_STORE_FOLDER}/$path" else ".$path")!! } @TestOnly class TestSchemeManagerFactory(private val basePath: Path) : SchemeManagerFactoryBase() { - override fun pathToFile(path: String) = basePath.resolve(path) + override fun pathToFile(path: String) = basePath.resolve(path)!! } } \ No newline at end of file diff --git a/platform/configuration-store-impl/src/SchemeManagerImpl.kt b/platform/configuration-store-impl/src/SchemeManagerImpl.kt index b4141213c8fe..157bdfcb3d57 100644 --- a/platform/configuration-store-impl/src/SchemeManagerImpl.kt +++ b/platform/configuration-store-impl/src/SchemeManagerImpl.kt @@ -62,7 +62,8 @@ class SchemeManagerImpl(val fileSpec: String, private val ioDirectory: Path, val roamingType: RoamingType = RoamingType.DEFAULT, virtualFileTrackerDisposable: Disposable? = null, - val presentableName: String? = null) : SchemeManager(), SafeWriteRequestor { + val presentableName: String? = null, + private val isUseOldFileNameSanitize: Boolean = false) : SchemeManager(), SafeWriteRequestor { private val schemes = ArrayList() private val readOnlyExternalizableSchemes = THashMap() @@ -559,7 +560,7 @@ class SchemeManagerImpl(val fileSpec: String, } private fun saveScheme(scheme: MUTABLE_SCHEME, nameGenerator: UniqueNameGenerator) { - var externalInfo: ExternalInfo? = schemeToInfo[scheme] + var externalInfo: ExternalInfo? = schemeToInfo.get(scheme) val currentFileNameWithoutExtension = externalInfo?.fileNameWithoutExtension val parent = processor.writeScheme(scheme) val element = if (parent is Element) parent else (parent as Document).detachRootElement() @@ -570,7 +571,7 @@ class SchemeManagerImpl(val fileSpec: String, var fileNameWithoutExtension = currentFileNameWithoutExtension if (fileNameWithoutExtension == null || isRenamed(scheme)) { - fileNameWithoutExtension = nameGenerator.generateUniqueName(FileUtil.sanitizeFileName(scheme.name, false)) + fileNameWithoutExtension = nameGenerator.generateUniqueName(FileUtil.sanitizeFileName(scheme.name, isUseOldFileNameSanitize)) } val newDigest = element!!.digest() diff --git a/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt b/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt index 5baf8fb0cb07..cdbbf5eac8d9 100644 --- a/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt @@ -27,10 +27,12 @@ import com.intellij.openapi.project.ex.ProjectEx import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.project.impl.ProjectImpl import com.intellij.openapi.vfs.VirtualFile -import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl import com.intellij.testFramework.* import com.intellij.testFramework.Assertions.assertThat -import com.intellij.util.* +import com.intellij.util.PathUtil +import com.intellij.util.readText +import com.intellij.util.systemIndependentPath +import com.intellij.util.write import org.intellij.lang.annotations.Language import org.junit.ClassRule import org.junit.Rule @@ -111,53 +113,6 @@ internal class ProjectStoreTest { } } - @Test fun `project inspection`() { - loadAndUseProject(tempDirManager, { - it.writeChild("${Project.DIRECTORY_STORE_FOLDER}/misc.xml", iprFileContent) - it.path - }) { project -> - val projectInspectionProfileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project) - - assertThat(projectInspectionProfileManager.state).isEmpty() - - projectInspectionProfileManager.currentProfile - - assertThat(projectInspectionProfileManager.state).isEmpty() - - // cause to use app profile - projectInspectionProfileManager.setRootProfile(null) - val doNotUseProjectProfileState = """ - - """.trimIndent() - assertThat(projectInspectionProfileManager.state).isEqualTo(doNotUseProjectProfileState) - - val inspectionDir = Paths.get(project.stateStore.stateStorageManager.expandMacros(PROJECT_CONFIG_DIR), "inspectionProfiles") - val file = inspectionDir.resolve("profiles_settings.xml") - project.saveStore() - assertThat(file).exists() - val doNotUseProjectProfileData = """ - - """.trimIndent() - assertThat(file.readText()).isEqualTo(doNotUseProjectProfileData) - - // test load - file.delete() - - project.baseDir.refresh(false, true) - (ProjectManager.getInstance() as StoreAwareProjectManager).flushChangedAlarm() - assertThat(projectInspectionProfileManager.state).isEmpty() - - file.write(doNotUseProjectProfileData) - project.baseDir.refresh(false, true) - (ProjectManager.getInstance() as StoreAwareProjectManager).flushChangedAlarm() - assertThat(projectInspectionProfileManager.state).isEqualTo(doNotUseProjectProfileState) - } - } - @Test fun fileBasedStorage() { loadAndUseProject(tempDirManager, { it.writeChild("test${ProjectFileType.DOT_DEFAULT_EXTENSION}", iprFileContent).path }) { project -> test(project) diff --git a/platform/core-api/src/com/intellij/openapi/options/scheme.kt b/platform/core-api/src/com/intellij/openapi/options/scheme.kt index f70f7030dc0e..f52fb9a68ece 100644 --- a/platform/core-api/src/com/intellij/openapi/options/scheme.kt +++ b/platform/core-api/src/com/intellij/openapi/options/scheme.kt @@ -32,26 +32,26 @@ interface ExternalizableScheme : Scheme { abstract class SchemeManagerFactory { companion object { @JvmStatic - fun getInstance() = ServiceManager.getService(SchemeManagerFactory::class.java) + fun getInstance() = ServiceManager.getService(SchemeManagerFactory::class.java)!! @JvmStatic - fun getInstance(project: Project) = ServiceManager.getService(project, SchemeManagerFactory::class.java) + fun getInstance(project: Project) = ServiceManager.getService(project, SchemeManagerFactory::class.java)!! } /** * directoryName — like "keymaps". */ @JvmOverloads - fun create(directoryName: String, processor: SchemeProcessor, presentableName: String? = null): SchemeManager = create(directoryName, processor, presentableName, RoamingType.DEFAULT) + fun create(directoryName: String, processor: SchemeProcessor, presentableName: String? = null, isUseOldFileNameSanitize: Boolean = false): SchemeManager = create(directoryName, processor, presentableName, RoamingType.DEFAULT, isUseOldFileNameSanitize) - protected abstract fun create(directoryName: String, processor: SchemeProcessor, presentableName: String? = null, roamingType: RoamingType = RoamingType.DEFAULT): SchemeManager + protected abstract fun create(directoryName: String, processor: SchemeProcessor, presentableName: String? = null, roamingType: RoamingType = RoamingType.DEFAULT, isUseOldFileNameSanitize: Boolean = false): SchemeManager } enum class SchemeState { UNCHANGED, NON_PERSISTENT, POSSIBLY_CHANGED } -abstract class SchemeProcessor { +abstract class SchemeProcessor { open fun isExternalizable(scheme: SCHEME) = scheme is ExternalizableScheme /** diff --git a/platform/testFramework/src/com/intellij/testFramework/MockSchemeManagerFactory.java b/platform/testFramework/src/com/intellij/testFramework/MockSchemeManagerFactory.java index ea2df0ed58dd..7d80304dfd80 100644 --- a/platform/testFramework/src/com/intellij/testFramework/MockSchemeManagerFactory.java +++ b/platform/testFramework/src/com/intellij/testFramework/MockSchemeManagerFactory.java @@ -26,9 +26,10 @@ public class MockSchemeManagerFactory extends SchemeManagerFactory { @NotNull @Override protected SchemeManager create(@NotNull String directoryName, - @NotNull SchemeProcessor processor, + @NotNull SchemeProcessor processor, @Nullable String presentableName, - @NotNull RoamingType roamingType) { + @NotNull RoamingType roamingType, + boolean isUseOldFileNameSanitize) { //noinspection unchecked return EMPTY; } diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 0b44bc1b2df2..023b0c0e439d 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -749,7 +749,7 @@ testDiscovery.enabled=false ruby.remote.debugger.supports.catchpoint.removal=true use.read.action.to.init.service=false -saving.state.in.new.format.is.allowed=false +saving.state.in.new.format.is.allowed=true ide.mac.new.color.picker=false diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java index fe1d2f71c628..e34aa12c724b 100644 --- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java +++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -1674,10 +1674,6 @@ public class FileUtil extends FileUtilRt { return map; } - public static boolean isRootPath(@NotNull File file) { - return isRootPath(file.getPath()); - } - public static boolean isRootPath(@NotNull String path) { return path.equals("/") || path.matches("[a-zA-Z]:[/\\\\]"); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/ProjectLevelVcsManagerSerialization.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/ProjectLevelVcsManagerSerialization.java index 4dcd86f5e9b6..377027b10910 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/ProjectLevelVcsManagerSerialization.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/ProjectLevelVcsManagerSerialization.java @@ -80,7 +80,7 @@ public class ProjectLevelVcsManagerSerialization { final Map confirmations = optionsAndConfirmations.getConfirmations(); for (VcsShowOptionsSettingImpl setting : options.values()) { - if (!Registry.is("saving.state.in.new.format.is.allowed", false) || !setting.getValue()) { + if (!Registry.is("saving.state.in.new.format.is.allowed", true) || !setting.getValue()) { Element settingElement = new Element(OPTIONS_SETTING); element.addContent(settingElement); settingElement.setAttribute(VALUE_ATTTIBUTE, Boolean.toString(setting.getValue())); @@ -89,7 +89,7 @@ public class ProjectLevelVcsManagerSerialization { } for (VcsShowConfirmationOptionImpl setting : confirmations.values()) { - if (!Registry.is("saving.state.in.new.format.is.allowed", false) || setting.getValue() != VcsShowConfirmationOption.Value.SHOW_CONFIRMATION) { + if (!Registry.is("saving.state.in.new.format.is.allowed", true) || setting.getValue() != VcsShowConfirmationOption.Value.SHOW_CONFIRMATION) { final Element settingElement = new Element(CONFIRMATIONS_SETTING); element.addContent(settingElement); settingElement.setAttribute(VALUE_ATTTIBUTE, setting.getValue().toString());