Wizard: fix filtering values in DropDownComponent
This commit is contained in:
committed by
Ilya Goncharov
parent
98f98d5856
commit
f824f03fa2
+4
-1
@@ -1,6 +1,7 @@
|
||||
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui
|
||||
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.Context
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.Reader
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.SettingsWriter
|
||||
@@ -46,7 +47,9 @@ abstract class DynamicComponent(private val context: Context) : Component() {
|
||||
init {
|
||||
write {
|
||||
eventManager.addSettingUpdaterEventListener { reference ->
|
||||
if (isInitialized) onValueUpdated(reference)
|
||||
if (isInitialized) ApplicationManager.getApplication().invokeLater {
|
||||
onValueUpdated(reference)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -8,6 +8,7 @@ import org.jetbrains.kotlin.tools.projectWizard.core.Context
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.SettingValidator
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.settingValidator
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.settings.SettingReference
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.DisplayableSettingItem
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import java.awt.event.ItemEvent
|
||||
@@ -103,6 +104,11 @@ class DropDownComponent<T : DisplayableSettingItem>(
|
||||
uiComponent.selectedItem = newValue
|
||||
}
|
||||
|
||||
override fun onValueUpdated(reference: SettingReference<*, *>?) {
|
||||
super.onValueUpdated(reference)
|
||||
filterValues()
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun getUiValue(): T? = uiComponent.selectedItem as? T
|
||||
}
|
||||
|
||||
+2
-4
@@ -37,10 +37,8 @@ abstract class UIComponentDelegatingSettingComponent<V : Any, T : SettingType<V>
|
||||
override fun onValueUpdated(reference: SettingReference<*, *>?) {
|
||||
super.onValueUpdated(reference)
|
||||
if (reference == this.reference) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
if (uiComponent.getUiValue() != value) {
|
||||
value?.let(uiComponent::updateUiValue)
|
||||
}
|
||||
if (uiComponent.getUiValue() != value) {
|
||||
value?.let(uiComponent::updateUiValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user