diff --git a/platform/configuration-store-impl/src/ApplicationStoreImpl.kt b/platform/configuration-store-impl/src/ApplicationStoreImpl.kt index 8a1b1abb29e2..b4334ad0778b 100644 --- a/platform/configuration-store-impl/src/ApplicationStoreImpl.kt +++ b/platform/configuration-store-impl/src/ApplicationStoreImpl.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2018 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. +// Copyright 2000-2019 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.configurationStore import com.intellij.configurationStore.schemeManager.ROOT_CONFIG @@ -32,7 +32,9 @@ class ApplicationStoreImpl(private val application: Application, pathMacroManage storageManager.addMacro(StoragePathMacros.CACHE_FILE, appSystemDir.resolve("workspace").resolve("app.xml").systemIndependentPath) } - override fun saveAdditionalComponents(isForce: Boolean) { + override fun afterSaveComponents(errors: MutableList, isForce: Boolean) { + super.afterSaveComponents(errors, isForce) + // here, because no Project (and so, ProjectStoreImpl) on Welcome Screen service().save(isForce) } diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index 09a2a0a36e4d..04d613fd5cfd 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -141,10 +141,8 @@ abstract class ComponentStoreImpl : IComponentStore { saveComponents(isForce, saveSessionProducerManager, errors) } - afterSaveComponents(errors) - try { - saveAdditionalComponents(isForce) + afterSaveComponents(errors, isForce) } catch (e: Throwable) { errors.add(e) @@ -157,13 +155,10 @@ abstract class ComponentStoreImpl : IComponentStore { CompoundRuntimeException.throwIfNotEmpty(errors) } - protected open fun saveAdditionalComponents(isForce: Boolean) { - } - protected open fun beforeSaveComponents(errors: MutableList) { } - protected open fun afterSaveComponents(errors: MutableList) { + protected open fun afterSaveComponents(errors: MutableList, isForce: Boolean) { } private fun saveComponents(isForce: Boolean, session: SaveSessionProducerManager, errors: MutableList): MutableList? { diff --git a/platform/configuration-store-impl/src/ComponentStoreWithExtraComponents.kt b/platform/configuration-store-impl/src/ComponentStoreWithExtraComponents.kt index 1bd4ab775292..60aa21d61de3 100644 --- a/platform/configuration-store-impl/src/ComponentStoreWithExtraComponents.kt +++ b/platform/configuration-store-impl/src/ComponentStoreWithExtraComponents.kt @@ -3,6 +3,7 @@ package com.intellij.configurationStore import com.intellij.configurationStore.schemeManager.SchemeManagerFactoryBase import com.intellij.openapi.components.SettingsSavingComponent +import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.project.isDirectoryBased abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() { @@ -31,13 +32,15 @@ abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() { } } - final override fun afterSaveComponents(errors: MutableList) { + override fun afterSaveComponents(errors: MutableList, isForce: Boolean) { val isIprProject = project?.let { !it.isDirectoryBased } ?: false for (settingsSavingComponent in settingsSavingComponents) { if (!isIprProject || settingsSavingComponent !is SchemeManagerFactoryBase) { try { settingsSavingComponent.save() } + catch (ignore: ProcessCanceledException) { + } catch (e: Throwable) { errors.add(e) }