diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/DropDownComponent.kt b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/DropDownComponent.kt index db03ebd5481..4c86d39a390 100644 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/DropDownComponent.kt +++ b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/components/DropDownComponent.kt @@ -19,7 +19,7 @@ class DropDownComponent( initialValues: List = emptyList(), initiallySelectedValue: T? = null, labelText: String? = null, - private val filter: (T) -> Boolean = { true }, + filter: (T) -> Boolean = { true }, private val validator: SettingValidator = settingValidator { ValidationResult.OK }, private val iconProvider: (T) -> Icon? = { null }, onValueUpdate: (T) -> Unit = {} @@ -68,10 +68,8 @@ class DropDownComponent( } } - fun setValues(newValues: List) { - @Suppress("UNCHECKED_CAST") - uiComponent.model = DefaultComboBoxModel(newValues.filter(filter).toTypedArray() as Array) - } + val valuesCount + get() = uiComponent.model.size override fun updateUiValue(newValue: T) = safeUpdateUi { uiComponent.selectedItem = newValue diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/setting/DefaultSettingComponent.kt b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/setting/DefaultSettingComponent.kt index ab90290594d..f6365ccc48a 100644 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/setting/DefaultSettingComponent.kt +++ b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/ui/setting/DefaultSettingComponent.kt @@ -118,6 +118,9 @@ class DropdownSettingComponent( labelText = setting.title.takeIf { needLabel }, onValueUpdate = { newValue -> value = newValue } ).asSubComponent() + + override fun shouldBeShow(): Boolean = + uiComponent.valuesCount > 1 } class BooleanSettingComponent(