mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove extra saveAdditionalComponents — afterSaveComponents is enough
This commit is contained in:
@@ -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<Throwable>, isForce: Boolean) {
|
||||
super.afterSaveComponents(errors, isForce)
|
||||
|
||||
// here, because no Project (and so, ProjectStoreImpl) on Welcome Screen
|
||||
service<DefaultProjectExportableAndSaveTrigger>().save(isForce)
|
||||
}
|
||||
|
||||
@@ -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<Throwable>) {
|
||||
}
|
||||
|
||||
protected open fun afterSaveComponents(errors: MutableList<Throwable>) {
|
||||
protected open fun afterSaveComponents(errors: MutableList<Throwable>, isForce: Boolean) {
|
||||
}
|
||||
|
||||
private fun saveComponents(isForce: Boolean, session: SaveSessionProducerManager, errors: MutableList<Throwable>): MutableList<Throwable>? {
|
||||
|
||||
@@ -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<Throwable>) {
|
||||
override fun afterSaveComponents(errors: MutableList<Throwable>, 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user