MPP wizard: take default JDK from default project template
Related to KT-23097
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4f2701385d
commit
879779ec0d
+7
-3
@@ -21,6 +21,7 @@ import com.intellij.ide.util.projectWizard.ProjectWizardUtil
|
|||||||
import com.intellij.ide.util.projectWizard.WizardContext
|
import com.intellij.ide.util.projectWizard.WizardContext
|
||||||
import com.intellij.openapi.externalSystem.model.project.ProjectId
|
import com.intellij.openapi.externalSystem.model.project.ProjectId
|
||||||
import com.intellij.openapi.options.ConfigurationException
|
import com.intellij.openapi.options.ConfigurationException
|
||||||
|
import com.intellij.openapi.project.ProjectManager
|
||||||
import com.intellij.openapi.projectRoots.JavaSdk
|
import com.intellij.openapi.projectRoots.JavaSdk
|
||||||
import com.intellij.openapi.projectRoots.Sdk
|
import com.intellij.openapi.projectRoots.Sdk
|
||||||
import com.intellij.openapi.roots.ui.configuration.JdkComboBox
|
import com.intellij.openapi.roots.ui.configuration.JdkComboBox
|
||||||
@@ -47,10 +48,11 @@ class KotlinGradleMultiplatformWizardStep(
|
|||||||
LabeledComponent.create(JTextField(), "Common module name:", BorderLayout.WEST)
|
LabeledComponent.create(JTextField(), "Common module name:", BorderLayout.WEST)
|
||||||
private val jvmCheckBox: JCheckBox =
|
private val jvmCheckBox: JCheckBox =
|
||||||
JCheckBox("Create JVM module", true)
|
JCheckBox("Create JVM module", true)
|
||||||
|
private val jdkModel = ProjectSdksModel().also {
|
||||||
|
it.reset(ProjectManager.getInstance().defaultProject)
|
||||||
|
}
|
||||||
private val jdkComboBox: JdkComboBox =
|
private val jdkComboBox: JdkComboBox =
|
||||||
JdkComboBox(ProjectSdksModel().also {
|
JdkComboBox(jdkModel) { it is JavaSdk }
|
||||||
it.reset(null)
|
|
||||||
}) { it is JavaSdk }
|
|
||||||
private val jvmModuleNameComponent: LabeledComponent<JTextField> =
|
private val jvmModuleNameComponent: LabeledComponent<JTextField> =
|
||||||
LabeledComponent.create(JTextField(), "JVM module name:", BorderLayout.WEST)
|
LabeledComponent.create(JTextField(), "JVM module name:", BorderLayout.WEST)
|
||||||
private val jsCheckBox: JCheckBox =
|
private val jsCheckBox: JCheckBox =
|
||||||
@@ -103,6 +105,8 @@ class KotlinGradleMultiplatformWizardStep(
|
|||||||
jvmModuleNameComponent.component.document.addDocumentListener(stopSyncEditingListener)
|
jvmModuleNameComponent.component.document.addDocumentListener(stopSyncEditingListener)
|
||||||
jsModuleNameComponent.component.document.addDocumentListener(stopSyncEditingListener)
|
jsModuleNameComponent.component.document.addDocumentListener(stopSyncEditingListener)
|
||||||
|
|
||||||
|
jdkComboBox.selectedJdk = jdkModel.projectSdk
|
||||||
|
|
||||||
jvmCheckBox.addItemListener {
|
jvmCheckBox.addItemListener {
|
||||||
jvmModuleNameComponent.isEnabled = jvmCheckBox.isSelected
|
jvmModuleNameComponent.isEnabled = jvmCheckBox.isSelected
|
||||||
jdkComboBox.isEnabled = jvmCheckBox.isSelected
|
jdkComboBox.isEnabled = jvmCheckBox.isSelected
|
||||||
|
|||||||
Reference in New Issue
Block a user