From 6ac5d86ea1f65e909f61d8fe4a22c9280dd42f07 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 7 Jan 2019 12:04:58 +0100 Subject: [PATCH] =?UTF-8?q?remove=20extra=20saveAdditionalComponents=20?= =?UTF-8?q?=E2=80=94=20afterSaveComponents=20is=20enough?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration-store-impl/src/ApplicationStoreImpl.kt | 6 ++++-- .../configuration-store-impl/src/ComponentStoreImpl.kt | 9 ++------- .../src/ComponentStoreWithExtraComponents.kt | 5 ++++- 3 files changed, 10 insertions(+), 10 deletions(-) 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) }