From a1b8db864c60c0ec652e2e647a5e2cbd29634d78 Mon Sep 17 00:00:00 2001 From: Pavel Porvatov Date: Wed, 29 Jun 2022 12:53:37 +0200 Subject: [PATCH] ProjectConfigurableUi: horizontal alignment improvement GitOrigin-RevId: c029e97c0165ece695e85fae2c9a94dc26c09f29 --- .../ui/configuration/ProjectConfigurableUi.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurableUi.kt b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurableUi.kt index 070da5f6cb8e..03bd787f0a98 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurableUi.kt +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectConfigurableUi.kt @@ -15,10 +15,12 @@ import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.pom.java.LanguageLevel import com.intellij.project.isDirectoryBased import com.intellij.ui.dsl.builder.* -import com.intellij.ui.dsl.gridLayout.HorizontalAlign import com.intellij.util.ui.JBUI import javax.swing.JPanel +private const val NAME_SDK_GROUP_NAME = "group1" +private const val LANGUAGE_COMPILER_GROUP_NAME = "group2" + internal class ProjectConfigurableUi(private val myProjectConfigurable: ProjectConfigurable, private val myProject: Project) { @@ -59,7 +61,7 @@ internal class ProjectConfigurableUi(private val myProjectConfigurable: ProjectC myPanel = headerlessPanel() } - fun Panel.titleAndNameField() { + private fun Panel.titleAndNameField() { if (myProject.isDirectoryBased) { row { label(JavaUiBundle.message("project.structure.title")) @@ -72,25 +74,26 @@ internal class ProjectConfigurableUi(private val myProjectConfigurable: ProjectC row(JavaUiBundle.message("project.structure.name")) { textField() .bindText(nameProperty) + .widthGroup(NAME_SDK_GROUP_NAME) .columns(28) } .bottomGap(BottomGap.SMALL) } } - fun headerlessPanel(): JPanel = panel { + private fun headerlessPanel(): JPanel = panel { titleAndNameField() row(JavaUiBundle.message("project.structure.sdk")) { cell(myProjectJdkConfigurable.createComponent()) + .widthGroup(NAME_SDK_GROUP_NAME) } .bottomGap(BottomGap.SMALL) row(JavaUiBundle.message("module.module.language.level")) { cell(myLanguageLevelCombo) - cell() + .widthGroup(LANGUAGE_COMPILER_GROUP_NAME) } - .layout(RowLayout.PARENT_GRID) .bottomGap(BottomGap.SMALL) row(JavaUiBundle.message("project.structure.compiler.output")) { @@ -106,11 +109,9 @@ internal class ProjectConfigurableUi(private val myProjectConfigurable: ProjectC LanguageLevelProjectExtensionImpl.getInstanceImpl(myProject).currentLevel = myLanguageLevelCombo.selectedLevel return@onIsModified true } - .horizontalAlign(HorizontalAlign.FILL) .comment(JavaUiBundle.message("project.structure.compiler.output.comment"), 100) - cell() + .widthGroup(LANGUAGE_COMPILER_GROUP_NAME) } - .layout(RowLayout.PARENT_GRID) }.apply { withBorder(JBUI.Borders.empty(20, 20)) }