mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
read-only sources must works without configured ICS repo — ui
This commit is contained in:
@@ -49,7 +49,11 @@ internal class IcsConfigurableUi : ConfigurableUi<IcsSettings>, 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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,13 @@ internal fun createRepositoryListEditor(): ConfigurableUi<IcsSettings> {
|
||||
|
||||
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<IcsSettings> {
|
||||
|
||||
override fun reset(settings: IcsSettings) {
|
||||
val list = ArrayList<RepositoryItem>()
|
||||
val upstream = icsManager.repositoryManager.getUpstream()?.let { RepositoryItem(it) }
|
||||
val upstream = icsManager.repositoryManager.getUpstream()?.let(::RepositoryItem)
|
||||
upstream?.let {
|
||||
list.add(it)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user