diff --git a/plugins/settings-repository/src/IcsConfigurable.kt b/plugins/settings-repository/src/IcsConfigurable.kt index bd4d54de70d5..e0f447234eb5 100644 --- a/plugins/settings-repository/src/IcsConfigurable.kt +++ b/plugins/settings-repository/src/IcsConfigurable.kt @@ -49,7 +49,11 @@ internal class IcsConfigurableUi : ConfigurableUi, Disposable { override fun apply(settings: IcsSettings) { settings.autoSync = autoSync.isSelected - editors.forEach { it.apply(settings) } + editors.forEach { + if (it.isModified(settings)) { + it.apply(settings) + } + } saveSettings(settings, icsManager.settingsFile) } diff --git a/plugins/settings-repository/src/ReadOnlySourceManager.kt b/plugins/settings-repository/src/ReadOnlySourceManager.kt index 39047b749f0c..f41094f5531c 100644 --- a/plugins/settings-repository/src/ReadOnlySourceManager.kt +++ b/plugins/settings-repository/src/ReadOnlySourceManager.kt @@ -15,6 +15,7 @@ */ package org.jetbrains.settingsRepository +import com.intellij.openapi.diagnostic.catchAndLog import com.intellij.openapi.diagnostic.debug import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.util.AtomicClearableLazyValue @@ -40,7 +41,11 @@ class ReadOnlySourceManager(private val settings: IcsSettings, val rootDir: Path } return settings.readOnlySources.mapSmartNotNull { source -> - try { + LOG.catchAndLog { + if (!source.active) { + return@mapSmartNotNull null + } + val path = source.path ?: return@mapSmartNotNull null val dir = rootDir.resolve(path) if (dir.exists()) { @@ -49,12 +54,8 @@ class ReadOnlySourceManager(private val settings: IcsSettings, val rootDir: Path else { LOG.warn("Skip read-only source ${source.url} because dir doesn't exist") } + null } - catch (e: Exception) { - LOG.error(e) - } - - null } } } diff --git a/plugins/settings-repository/src/repositoryListEditor.kt b/plugins/settings-repository/src/repositoryListEditor.kt index dbfa024bbbbb..1b666bd65c72 100644 --- a/plugins/settings-repository/src/repositoryListEditor.kt +++ b/plugins/settings-repository/src/repositoryListEditor.kt @@ -54,8 +54,13 @@ internal fun createRepositoryListEditor(): ConfigurableUi { override fun getComponent() = panel { row("Repository:") { - editor.comboBox() - deleteButton() + if (editor.model.isEmpty) { + hint("Use File -> Settings Repository... to configure") + } + else { + editor.comboBox() + deleteButton() + } } } @@ -69,7 +74,7 @@ internal fun createRepositoryListEditor(): ConfigurableUi { override fun reset(settings: IcsSettings) { val list = ArrayList() - val upstream = icsManager.repositoryManager.getUpstream()?.let { RepositoryItem(it) } + val upstream = icsManager.repositoryManager.getUpstream()?.let(::RepositoryItem) upstream?.let { list.add(it) }