浏览代码

fix selection default of arch combobox

windchargerj 1 年之前
父节点
当前提交
52248d03f7

+ 1 - 1
src/main/kotlin/io/xmake/run/XMakeRunConfiguration.kt

@@ -36,7 +36,7 @@ class XMakeRunConfiguration(
     var runPlatform: String = SystemUtils.platform()
 
     @OptionTag(tag = "architecture")
-    var runArchitecture: String = ""
+    var runArchitecture: String = getArchitecturesByPlatform(runPlatform).first()
 
     @OptionTag(tag = "mode")
     var runMode: String = "release"

+ 6 - 2
src/main/kotlin/io/xmake/run/XMakeRunConfigurationEditor.kt

@@ -172,8 +172,12 @@ class XMakeRunConfigurationEditor(
                 row {
                     cell(platformsComboBox).applyToComponent {
                         addItemListener {
-                            architecturesModel.removeAllElements()
-                            architecturesModel.addAll(getArchitecturesByPlatform(runConfiguration.runPlatform).toMutableList())
+                            val architectures = getArchitecturesByPlatform(selectedItem as String)
+                            with(architecturesModel) {
+                                removeAllElements()
+                                addAll(architectures.toMutableList())
+                                selectedItem = architectures.first()
+                            }
                         }
                     }.align(AlignX.FILL)
                 }