diff --git a/platform/configuration-store-impl/src/SchemeManagerImpl.kt b/platform/configuration-store-impl/src/SchemeManagerImpl.kt index 74703ab9f06f..839aafaa632f 100644 --- a/platform/configuration-store-impl/src/SchemeManagerImpl.kt +++ b/platform/configuration-store-impl/src/SchemeManagerImpl.kt @@ -204,7 +204,7 @@ class SchemeManagerImpl(val fileSpec: String, lazyPreloadScheme(bytes, isOldSchemeNaming) { name, parser -> val attributeProvider = Function { parser.getAttributeValue(null, it) } val schemeName = name - ?: processor.getName(attributeProvider, FileUtilRt.getNameWithoutExtension(fileName)) + ?: processor.getSchemeKey(attributeProvider, FileUtilRt.getNameWithoutExtension(fileName)) ?: throw RuntimeException("Name is missed:\n${bytes.toString(Charsets.UTF_8)}") val dataHolder = SchemeDataHolderImpl(bytes, externalInfo) @@ -286,17 +286,15 @@ class SchemeManagerImpl(val fileSpec: String, val extension = getFileExtension(fileName, true) val externalInfo = ExternalInfo(fileName.substring(0, fileName.length - extension.length), extension) - val schemeName = name - ?: (processor as LazySchemeProcessor).getName(attributeProvider, externalInfo.fileNameWithoutExtension) - ?: throw RuntimeException("Name is missed:\n${bytes.toString(Charsets.UTF_8)}") + val schemeKey = name + ?: (processor as LazySchemeProcessor).getSchemeKey(attributeProvider, externalInfo.fileNameWithoutExtension) + ?: throw RuntimeException("Name is missed:\n${bytes.toString(Charsets.UTF_8)}") - externalInfo.schemeName = schemeName + externalInfo.schemeKey = schemeKey - val scheme = (processor as LazySchemeProcessor).createScheme(SchemeDataHolderImpl(bytes, externalInfo), schemeName, - attributeProvider, true) + val scheme = (processor as LazySchemeProcessor).createScheme(SchemeDataHolderImpl(bytes, externalInfo), schemeKey, attributeProvider, true) val oldInfo = schemeToInfo.put(scheme, externalInfo) LOG.assertTrue(oldInfo == null) - val schemeKey = processor.getSchemeKey(scheme) val oldScheme = schemeListManager.readOnlyExternalizableSchemes.put(schemeKey, scheme) if (oldScheme != null) { LOG.warn("Duplicated scheme ${schemeKey} - old: $oldScheme, new $scheme") @@ -475,7 +473,7 @@ class SchemeManagerImpl(val fileSpec: String, element?.let { info.digest = it.digest() } - info.schemeName = schemeName + info.schemeKey = schemeName return info } @@ -485,7 +483,7 @@ class SchemeManagerImpl(val fileSpec: String, val bytes = input.readBytes() lazyPreloadScheme(bytes, isOldSchemeNaming) { name, parser -> val attributeProvider = Function { parser.getAttributeValue(null, it) } - val schemeName = name ?: processor.getName(attributeProvider, fileNameWithoutExtension) + val schemeName = name ?: processor.getSchemeKey(attributeProvider, fileNameWithoutExtension) if (schemeName == null) { throw RuntimeException("Name is missed:\n${bytes.toString(Charsets.UTF_8)}") } @@ -721,7 +719,7 @@ class SchemeManagerImpl(val fileSpec: String, externalInfo.setFileNameWithoutExtension(fileNameWithoutExtension, schemeExtension) } externalInfo.digest = newDigest - externalInfo.schemeName = processor.getSchemeKey(scheme) + externalInfo.schemeKey = processor.getSchemeKey(scheme) } private fun isEqualToBundledScheme(externalInfo: ExternalInfo?, newDigest: ByteArray, scheme: MUTABLE_SCHEME): Boolean { @@ -766,7 +764,7 @@ class SchemeManagerImpl(val fileSpec: String, private fun isRenamed(scheme: T): Boolean { val info = schemeToInfo.get(scheme) - return info != null && processor.getSchemeKey(scheme) != info.schemeName + return info != null && processor.getSchemeKey(scheme) != info.schemeKey } private fun deleteFiles(errors: MutableList, filesToDelete: MutableSet) { diff --git a/platform/configuration-store-impl/src/schemeManager/schemeLoader.kt b/platform/configuration-store-impl/src/schemeManager/schemeLoader.kt index f4dd62158eb7..3af08ce60799 100644 --- a/platform/configuration-store-impl/src/schemeManager/schemeLoader.kt +++ b/platform/configuration-store-impl/src/schemeManager/schemeLoader.kt @@ -66,7 +66,7 @@ private fun preload(isOldSchemeNaming: Boolean, parser: MXParser): String? { internal class ExternalInfo(var fileNameWithoutExtension: String, var fileExtension: String?) { // we keep it to detect rename - var schemeName: String? = null + var schemeKey: String? = null var digest: ByteArray? = null diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java index 303d890d3322..358d5268d3dd 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java @@ -1,18 +1,4 @@ -/* - * 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. - * 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. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.ex; import com.intellij.codeHighlighting.HighlightDisplayLevel; @@ -85,7 +71,7 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa mySchemeManager = schemeManagerFactory.create(INSPECTION_DIR, new InspectionProfileProcessor() { @NotNull @Override - public String getName(@NotNull Function attributeProvider, @NotNull String fileNameWithoutExtension) { + public String getSchemeKey(@NotNull Function attributeProvider, @NotNull String fileNameWithoutExtension) { return fileNameWithoutExtension; } diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationSchemeManager.kt b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationSchemeManager.kt index 1e091fbb2518..714c41edbc01 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationSchemeManager.kt +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationSchemeManager.kt @@ -15,7 +15,7 @@ private val LOG = logger() internal class RunConfigurationSchemeManager(private val manager: RunManagerImpl, private val isShared: Boolean) : LazySchemeProcessor(), SchemeContentChangedHandler { override fun getSchemeKey(scheme: RunnerAndConfigurationSettingsImpl): String { - return scheme.name + return if (isShared) scheme.name else "${scheme.type.id}-${scheme.name}" } override fun createScheme(dataHolder: SchemeDataHolder, name: String, attributeProvider: Function, isBundled: Boolean): RunnerAndConfigurationSettingsImpl { @@ -53,7 +53,7 @@ internal class RunConfigurationSchemeManager(private val manager: RunManagerImpl return element } - override fun getName(attributeProvider: Function, fileNameWithoutExtension: String): String? { + override fun getSchemeKey(attributeProvider: Function, fileNameWithoutExtension: String): String? { var name = attributeProvider.apply("name") if (name == "