From a42214723c0065aa6cf4d1a102e25ed2f331e1e9 Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Fri, 12 Mar 2021 13:41:00 +0100 Subject: [PATCH] runtime-chooser: IDEA-263881 - style the warning label GitOrigin-RevId: 7f89a163470b90ceef5ad69bbb292116afac1351 --- .../jdkDownloader/RuntimeChooserDialog.kt | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserDialog.kt b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserDialog.kt index 3642ba02ab85..2613c99d4fe0 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserDialog.kt +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserDialog.kt @@ -4,6 +4,8 @@ package com.intellij.openapi.projectRoots.impl.jdkDownloader import com.intellij.icons.AllIcons import com.intellij.lang.LangBundle import com.intellij.openapi.actionSystem.DataProvider +import com.intellij.openapi.editor.colors.EditorColors +import com.intellij.openapi.editor.colors.EditorColorsManager import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory import com.intellij.openapi.project.Project import com.intellij.openapi.ui.ComboBox @@ -11,11 +13,18 @@ import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.ui.TextFieldWithBrowseButton import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.HtmlChunk +import com.intellij.ui.IdeBorderFactory +import com.intellij.ui.JBColor +import com.intellij.ui.SideBorder import com.intellij.ui.SimpleColoredComponent +import com.intellij.ui.components.JBLabel import com.intellij.ui.components.JBTextField import com.intellij.ui.layout.* import com.intellij.util.castSafelyTo import com.intellij.util.io.isDirectory +import com.intellij.util.ui.JBUI +import com.intellij.util.ui.components.BorderLayoutPanel +import java.awt.Color import java.nio.file.Path import java.nio.file.Paths import javax.swing.Action @@ -79,6 +88,27 @@ class RuntimeChooserDialog( return RuntimeChooserDialogResult.Cancel } + override fun createTitlePane(): JComponent { + return object : BorderLayoutPanel() { + init { + border = JBUI.Borders.merge(JBUI.Borders.empty(10), IdeBorderFactory.createBorder(JBColor.border(), SideBorder.BOTTOM), true) + + addToCenter(JBLabel().apply { + icon = AllIcons.General.Warning + text = HtmlChunk + .html() + .addText(LangBundle.message("dialog.label.choose.ide.runtime.warn")) + .toString() + }) + + withPreferredWidth(400) + } + + override fun getBackground(): Color? = + EditorColorsManager.getInstance().globalScheme.getColor(EditorColors.NOTIFICATION_BACKGROUND) ?: super.getBackground() + } + } + override fun createCenterPanel(): JComponent { jdkCombobox = object : ComboBox(model.mainComboBoxModel) { init { @@ -104,19 +134,6 @@ class RuntimeChooserDialog( } return panel { - - - noteRowInTheDialog() - - row("") { - label( - HtmlChunk - .html() - .addText(LangBundle.message("dialog.label.choose.ide.runtime.warn")) - .toString() - ).growPolicy(GrowPolicy.MEDIUM_TEXT).constraints(growX, growY).component.icon = AllIcons.General.Warning - } - row(LangBundle.message("dialog.label.choose.ide.runtime.current")) { val control = SimpleColoredComponent() control().constraints(growX)