Skip to content

Commit

Permalink
Updated the settings layout
Browse files Browse the repository at this point in the history
  • Loading branch information
codemakerai-dev committed Apr 5, 2024
1 parent 1e4c989 commit 60d1337
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
package ai.codemaker.jetbrains.settings

import ai.codemaker.jetbrains.service.CodeMakerService
import ai.codemaker.sdkv2.client.model.Model
import com.intellij.ide.BrowserUtil
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.ComboBox
import com.intellij.ui.components.*
import com.intellij.util.ui.FormBuilder
import java.awt.FlowLayout
import javax.swing.DefaultComboBoxModel
import javax.swing.JButton
import javax.swing.JPanel
Expand All @@ -20,7 +20,7 @@ class AppSettingsComponent(project: Project) {
val panel: JPanel
private val apiKeyText = JBTextField()
private val modelCombo = ComboBox(arrayOf(defaultModel))
private val reloadModelsButton = JButton("Refresh")
private val updateModelsButton = JButton("Update")
private val codeActionsEnabledCheck = JBCheckBox()
private val autocompletionEnabledCheck = JBCheckBox()
private val multilineAutocompletionEnabledCheck = JBCheckBox()
Expand All @@ -36,7 +36,7 @@ class AppSettingsComponent(project: Project) {
}
createAccountLabel.setExternalLinkIcon()

reloadModelsButton.addActionListener({
updateModelsButton.addActionListener({
val service: CodeMakerService = project.getService(CodeMakerService::class.java)
val models = service.listModels()

Expand All @@ -47,12 +47,15 @@ class AppSettingsComponent(project: Project) {
modelCombo.model = DefaultComboBoxModel(allModels.toTypedArray())
})

val modelPanel = JPanel(FlowLayout(FlowLayout.LEFT))
modelPanel.add(modelCombo)
modelPanel.add(updateModelsButton)

panel = FormBuilder.createFormBuilder()
.addComponent(createAccountLabel)
.addSeparator()
.addLabeledComponent(JBLabel("API Key: "), apiKeyText, 1, false)
.addLabeledComponent(JBLabel("Model: "), modelCombo, 1, false)
.addComponentToRightColumn(reloadModelsButton)
.addLabeledComponent(JBLabel("Model: "), modelPanel, 1, false)
.addSeparator()
.addLabeledComponent(JBLabel("Enable autocompletion: "), autocompletionEnabledCheck, 1, false)
.addLabeledComponent(JBLabel("Enable multiline autocompletion: "), multilineAutocompletionEnabledCheck, 1, false)
Expand Down

0 comments on commit 60d1337

Please sign in to comment.