diff --git a/platform/lang-api/resources/messages/LangBundle.properties b/platform/lang-api/resources/messages/LangBundle.properties index 3430997160ee..789f58bad5fd 100644 --- a/platform/lang-api/resources/messages/LangBundle.properties +++ b/platform/lang-api/resources/messages/LangBundle.properties @@ -534,6 +534,6 @@ dialog.separator.choose.ide.runtime.advancedJbrs=More Runtimes dialog.separator.choose.ide.runtime.customSelected=Manually Added dialog.button.choose.ide.runtime.useDefault=Use Default Runtime dialog.title.choose.ide.runtime.select.path.to.install.jdk=Select Path to Download the IDE Boot Runtime -dialog.message.choose.ide.runtime.select.path.to.install.jdk=The selected boot runtime will be downloaded and set for the current IDE +dialog.message.choose.ide.runtime.select.path.to.install.jdk=The selected boot runtime will be downloaded if needed and set for the current IDE dialog.label.choose.ide.runtime.warn=Changing the runtime may cause unexpected problems. Do not change it unless you were specifically asked to do so by JetBrains support. project.view.elements.selected={0} elements selected 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 2613c99d4fe0..f2181629e1f3 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 @@ -152,51 +152,32 @@ class RuntimeChooserDialog( jdkCombobox.invoke(growX) } - //download row - row(LangBundle.message("dialog.label.choose.ide.runtime.location")) { - val locationLabel = JBTextField() - locationLabel.isEditable = false - locationLabel.invoke(growX) - - val updateLocation = { - (jdkCombobox.selectedItem as? RuntimeChooserItemWithFixedLocation)?.let { item -> - locationLabel.text = FileUtil.getLocationRelativeToUserHome(item.homeDir, false) - } - } - updateLocation() - jdkCombobox.addItemListener { updateLocation() } - }.onlyVisibleWhenSelected { it is RuntimeChooserItemWithFixedLocation } - //download row row(LangBundle.message("dialog.label.choose.ide.runtime.location")) { jdkInstallDirSelector = textFieldWithBrowseButton( project = project, browseDialogTitle = LangBundle.message("dialog.title.choose.ide.runtime.select.path.to.install.jdk"), fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor() - ).constraints(growX).component + ).constraints(growX) + .comment(LangBundle.message("dialog.message.choose.ide.runtime.select.path.to.install.jdk")) + .component val updateLocation = { (jdkCombobox.selectedItem as? RuntimeChooserDownloadableItem)?.let { item -> jdkInstallDirSelector.text = model.getDefaultInstallPathFor(item.item) + jdkInstallDirSelector.isEditable = true + jdkInstallDirSelector.setButtonEnabled(true) + } + + (jdkCombobox.selectedItem as? RuntimeChooserItemWithFixedLocation)?.let { item -> + jdkInstallDirSelector.text = FileUtil.getLocationRelativeToUserHome(item.homeDir, false) + jdkInstallDirSelector.isEditable = false + jdkInstallDirSelector.setButtonEnabled(false) } } updateLocation() jdkCombobox.addItemListener { updateLocation() } - }.onlyVisibleWhenSelected { it is RuntimeChooserDownloadableItem } - - row { - comment(LangBundle.message("dialog.message.choose.ide.runtime.select.path.to.install.jdk")) - }.onlyVisibleWhenSelected { it is RuntimeChooserDownloadableItem } + } } } - - private fun Row.onlyVisibleWhenSelected(isVisible: (RuntimeChooserItem?) -> Boolean) { - val updateVisible = { - val visible = isVisible(jdkCombobox.selectedItem as? RuntimeChooserItem) - this@onlyVisibleWhenSelected.visible = visible - this@onlyVisibleWhenSelected.enabled = visible - } - updateVisible() - jdkCombobox.addItemListener { updateVisible() } - } }