Browse Source

upgrade ui api version

Seedking 1 year ago
parent
commit
e352bea058
2 changed files with 10 additions and 16 deletions
  1. 1 0
      change-notes.html
  2. 9 16
      src/main/kotlin/io/xmake/run/XMakeRunConfigurationEditor.kt

+ 1 - 0
change-notes.html

@@ -1,6 +1,7 @@
 <strong>1.3.3</strong>
 <ul>
     <li>[FIX]: Update version</li>
+    <li>[FIX]: Upgrade ui api version</li>
 </ul>
 <strong>1.3.2</strong>
 <ul>

+ 9 - 16
src/main/kotlin/io/xmake/run/XMakeRunConfigurationEditor.kt

@@ -6,8 +6,8 @@ import com.intellij.openapi.options.SettingsEditor
 import com.intellij.openapi.project.Project
 import com.intellij.openapi.ui.ComboBox
 import com.intellij.ui.RawCommandLineEditor
-import com.intellij.ui.layout.*
-import com.intellij.ui.components.Label
+import com.intellij.ui.dsl.builder.AlignX
+import com.intellij.ui.dsl.builder.panel
 import io.xmake.shared.xmakeConfiguration
 import java.awt.Dimension
 import javax.swing.JComponent
@@ -56,29 +56,22 @@ class XMakeRunConfigurationEditor(private val project: Project) : SettingsEditor
 
     // create editor
     override fun createEditor(): JComponent = panel {
-
-        labeledRow("Default target:", targetsComboBox) {
-            targetsComboBox(CCFlags.push)
+        row("Default target:") {
+            cell(targetsComboBox).align(AlignX.FILL)
         }
 
-        labeledRow("Run arguments:", runArguments) {
-            runArguments.apply {
-                makeWide()
-            }()
+        row("Environment variables:") {
+            cell(runArguments).align(AlignX.FILL)
+        }
+        row(environmentVariables.label) {
+            cell(environmentVariables).align(AlignX.FILL)
         }
-        row(environmentVariables.label) { environmentVariables.apply { makeWide() }() }
     }
 
     private fun JPanel.makeWide() {
         preferredSize = Dimension(1000, height)
     }
 
-    private fun LayoutBuilder.labeledRow(labelText: String, component: JComponent, init: Row.() -> Unit) {
-        val label = Label(labelText)
-        label.labelFor = component
-        row(label) { init() }
-    }
-
     companion object {
 
         // get log