diff --git a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt index 6a1c316..f3a3eea 100644 --- a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt +++ b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/clients/LLMClientTable.kt @@ -156,12 +156,6 @@ class LLMClientTable { } } - // Register validators of the currently active cards - val dialogPanel = cardLayout.findComponentById(llmClient.getClientName()) as DialogPanel - dialogPanel.registerValidators(myDisposable) { - isOKActionEnabled = ContainerUtil.and(it.values) { info: ValidationInfo -> info.okEnabled } - } - val cardsList = JBList(llmClientConfigurations).apply { val descriptor = object : ListItemDescriptorAdapter() { override fun getTextFor(value: LLMClientConfiguration) = value.getClientName() @@ -175,6 +169,12 @@ class LLMClientTable { addListSelectionListener { llmClient = selectedValue cardLayout.show(cardPanel, llmClient.getClientName()) + + // Register validators of the currently active cards + val dialogPanel = cardLayout.findComponentById(llmClient.getClientName()) as DialogPanel + dialogPanel.registerValidators(myDisposable) { + isOKActionEnabled = ContainerUtil.and(it.values) { info: ValidationInfo -> info.okEnabled } + } } setSelectedValue(llmClient, true) }