ProjectInspectionProfileManagerImpl — isUseOldFileNameSanitize because directory based storage uses strict sanitize, but scheme manager non-strict

enable saving.state.in.new.format.is.allowed
This commit is contained in:
Vladimir Krivosheev
2016-06-24 17:49:51 +02:00
parent cad5710c3e
commit a89bc716e0
18 changed files with 169 additions and 101 deletions
@@ -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() {
@@ -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);
}
}
+1
View File
@@ -55,5 +55,6 @@
<orderEntry type="module" module-name="built-in-server-api" scope="TEST" />
<orderEntry type="module" module-name="configuration-store-impl" scope="TEST" />
<orderEntry type="library" scope="TEST" name="memoryfilesystem" level="project" />
<orderEntry type="module" module-name="configuration-store-tests" scope="TEST" />
</component>
</module>
@@ -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 = """
<state>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</state>""".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 = """
<component name="InspectionProjectProfileManager">
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</component>""".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("""
<inspections profile_name="Project Default" version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Convert2Diamond" enabled="false" level="WARNING" enabled_by_default="false" />
</inspections>""".trimIndent())
}
}
}
@@ -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()));
}
@@ -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);
}
@@ -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<Elem
@Nullable
public static NamedScope getScope(@NotNull Project project, final String scopeName) {
final NamedScopesHolder[] holders = getAllNamedScopeHolders(project);
for (NamedScopesHolder holder : holders) {
for (NamedScopesHolder holder : getAllNamedScopeHolders(project)) {
final NamedScope scope = holder.getScope(scopeName);
if (scope != null) {
return scope;
@@ -523,14 +523,14 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
getTools(toolId, element.getProject()).disableTool(element);
}
public void disableToolByDefault(@NotNull List<String> toolIds, Project project) {
public void disableToolByDefault(@NotNull List<String> 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<String> computable = extension == null ? new Computable.PredefinedValueComputable<String>(toolWrapper.getDisplayName()) : (Computable<String>)extension::getDisplayName;
Computable<String> computable = extension == null ? new Computable.PredefinedValueComputable<String>(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<InspectionToolWrapper> createTools(Project project) {
private List<InspectionToolWrapper> 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<ScopeToolState> getDefaultStates(Project project) {
public List<ScopeToolState> getDefaultStates(@Nullable Project project) {
initInspectionTools(project);
final List<ScopeToolState> result = new ArrayList<>();
for (Tools tools : myTools.values()) {
@@ -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) {
@@ -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<ByteArray, String> {
}
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<ByteArray, String>(bytes, lineSeparator)
}
@@ -40,10 +40,10 @@ sealed class SchemeManagerFactoryBase : SchemeManagerFactory(), SettingsSavingCo
protected open val componentManager: ComponentManager? = null
override final fun <T : Scheme, MutableT : T> create(directoryName: String, processor: SchemeProcessor<T, MutableT>, presentableName: String?, roamingType: RoamingType): SchemeManager<T> {
override final fun <T : Scheme, MutableT : T> create(directoryName: String, processor: SchemeProcessor<T, MutableT>, presentableName: String?, roamingType: RoamingType, isUseOldFileNameSanitize: Boolean): SchemeManager<T> {
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<Scheme, out Scheme>)
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)!!
}
}
@@ -62,7 +62,8 @@ class SchemeManagerImpl<T : Scheme, MUTABLE_SCHEME : T>(val fileSpec: String,
private val ioDirectory: Path,
val roamingType: RoamingType = RoamingType.DEFAULT,
virtualFileTrackerDisposable: Disposable? = null,
val presentableName: String? = null) : SchemeManager<T>(), SafeWriteRequestor {
val presentableName: String? = null,
private val isUseOldFileNameSanitize: Boolean = false) : SchemeManager<T>(), SafeWriteRequestor {
private val schemes = ArrayList<T>()
private val readOnlyExternalizableSchemes = THashMap<String, T>()
@@ -559,7 +560,7 @@ class SchemeManagerImpl<T : Scheme, MUTABLE_SCHEME : T>(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<T : Scheme, MUTABLE_SCHEME : T>(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()
@@ -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 = """
<state>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</state>""".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 = """
<component name="InspectionProjectProfileManager">
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</component>""".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)
@@ -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 <SCHEME : Scheme, MUTABLE_SCHEME: SCHEME> create(directoryName: String, processor: SchemeProcessor<SCHEME, MUTABLE_SCHEME>, presentableName: String? = null): SchemeManager<SCHEME> = create(directoryName, processor, presentableName, RoamingType.DEFAULT)
fun <SCHEME : Scheme, MUTABLE_SCHEME: SCHEME> create(directoryName: String, processor: SchemeProcessor<SCHEME, MUTABLE_SCHEME>, presentableName: String? = null, isUseOldFileNameSanitize: Boolean = false): SchemeManager<SCHEME> = create(directoryName, processor, presentableName, RoamingType.DEFAULT, isUseOldFileNameSanitize)
protected abstract fun <SCHEME : Scheme, MUTABLE_SCHEME: SCHEME> create(directoryName: String, processor: SchemeProcessor<SCHEME, MUTABLE_SCHEME>, presentableName: String? = null, roamingType: RoamingType = RoamingType.DEFAULT): SchemeManager<SCHEME>
protected abstract fun <SCHEME : Scheme, MUTABLE_SCHEME: SCHEME> create(directoryName: String, processor: SchemeProcessor<SCHEME, MUTABLE_SCHEME>, presentableName: String? = null, roamingType: RoamingType = RoamingType.DEFAULT, isUseOldFileNameSanitize: Boolean = false): SchemeManager<SCHEME>
}
enum class SchemeState {
UNCHANGED, NON_PERSISTENT, POSSIBLY_CHANGED
}
abstract class SchemeProcessor<SCHEME : Scheme, MUTABLE_SCHEME: SCHEME> {
abstract class SchemeProcessor<SCHEME : Scheme, in MUTABLE_SCHEME: SCHEME> {
open fun isExternalizable(scheme: SCHEME) = scheme is ExternalizableScheme
/**
@@ -26,9 +26,10 @@ public class MockSchemeManagerFactory extends SchemeManagerFactory {
@NotNull
@Override
protected <SCHEME extends Scheme, MUTABLE_SCHEME extends SCHEME> SchemeManager<SCHEME> create(@NotNull String directoryName,
@NotNull SchemeProcessor<SCHEME, MUTABLE_SCHEME> processor,
@NotNull SchemeProcessor<SCHEME, ? super MUTABLE_SCHEME> processor,
@Nullable String presentableName,
@NotNull RoamingType roamingType) {
@NotNull RoamingType roamingType,
boolean isUseOldFileNameSanitize) {
//noinspection unchecked
return EMPTY;
}
@@ -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
@@ -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]:[/\\\\]");
}
@@ -80,7 +80,7 @@ public class ProjectLevelVcsManagerSerialization {
final Map<String, VcsShowConfirmationOptionImpl> 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());