ProjectConfigurableUi: horizontal alignment improvement

GitOrigin-RevId: c029e97c0165ece695e85fae2c9a94dc26c09f29
This commit is contained in:
Pavel Porvatov
2022-06-29 12:53:37 +02:00
committed by intellij-monorepo-bot
parent 09853b68d9
commit a1b8db864c

View File

@@ -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))
}