Wizard: always allow user to choose project JDK
This commit is contained in:
+1
-2
@@ -41,7 +41,7 @@ class IdeWizard(
|
|||||||
JavaRuntimeLibraryDescription(null),
|
JavaRuntimeLibraryDescription(null),
|
||||||
LibrariesContainerFactory.createContainer(null as Project?),
|
LibrariesContainerFactory.createContainer(null as Project?),
|
||||||
)
|
)
|
||||||
|
var jdk: Sdk? = null
|
||||||
|
|
||||||
var projectPath by setting(StructurePlugin::projectPath.reference)
|
var projectPath by setting(StructurePlugin::projectPath.reference)
|
||||||
var projectName by setting(StructurePlugin::name.reference)
|
var projectName by setting(StructurePlugin::name.reference)
|
||||||
@@ -69,7 +69,6 @@ class IdeWizard(
|
|||||||
data class JpsData(
|
data class JpsData(
|
||||||
val libraryDescription: JavaRuntimeLibraryDescription,
|
val libraryDescription: JavaRuntimeLibraryDescription,
|
||||||
val librariesContainer: LibrariesContainer,
|
val librariesContainer: LibrariesContainer,
|
||||||
var jdk: Sdk? = null,
|
|
||||||
val libraryOptionsPanel: LibraryOptionsPanel = LibraryOptionsPanel(
|
val libraryOptionsPanel: LibraryOptionsPanel = LibraryOptionsPanel(
|
||||||
libraryDescription,
|
libraryDescription,
|
||||||
"",
|
"",
|
||||||
|
|||||||
+3
@@ -90,6 +90,9 @@ class NewProjectWizardModuleBuilder : EmptyModuleBuilder() {
|
|||||||
model: ModifiableModuleModel?,
|
model: ModifiableModuleModel?,
|
||||||
modulesProvider: ModulesProvider?
|
modulesProvider: ModulesProvider?
|
||||||
): List<IdeaModule>? {
|
): List<IdeaModule>? {
|
||||||
|
runWriteAction {
|
||||||
|
wizard.jdk?.let { jdk -> NewProjectUtil.applyJdkToProject(project, jdk) }
|
||||||
|
}
|
||||||
val modulesModel = model ?: ModuleManager.getInstance(project).modifiableModel
|
val modulesModel = model ?: ModuleManager.getInstance(project).modifiableModel
|
||||||
val success = wizard.apply(
|
val success = wizard.apply(
|
||||||
services = buildList {
|
services = buildList {
|
||||||
|
|||||||
-1
@@ -62,7 +62,6 @@ class IdeaJpsWizardService(
|
|||||||
modulesIrs: List<ModuleIR>,
|
modulesIrs: List<ModuleIR>,
|
||||||
buildSystem: BuildSystemType
|
buildSystem: BuildSystemType
|
||||||
): TaskResult<Unit> = runWriteAction {
|
): TaskResult<Unit> = runWriteAction {
|
||||||
ideWizard.jpsData.jdk?.let { jdk -> NewProjectUtil.applyJdkToProject(project, jdk) }
|
|
||||||
KotlinSdkType.setUpIfNeeded()
|
KotlinSdkType.setUpIfNeeded()
|
||||||
val projectImporter = ProjectImporter(project, modulesModel, path, modulesIrs)
|
val projectImporter = ProjectImporter(project, modulesModel, path, modulesIrs)
|
||||||
modulesBuilder.addModuleConfigurationUpdater(
|
modulesBuilder.addModuleConfigurationUpdater(
|
||||||
|
|||||||
+5
-4
@@ -49,13 +49,15 @@ class ProjectSettingsComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizar
|
|||||||
component.addBorder(JBUI.Borders.empty(0, /*left&right*/4))
|
component.addBorder(JBUI.Borders.empty(0, /*left&right*/4))
|
||||||
}
|
}
|
||||||
private val buildSystemAdditionalSettingsComponent = BuildSystemAdditionalSettingsComponent(ideWizard).asSubComponent()
|
private val buildSystemAdditionalSettingsComponent = BuildSystemAdditionalSettingsComponent(ideWizard).asSubComponent()
|
||||||
|
private val jdkComponent = JdkComponent(ideWizard).asSubComponent()
|
||||||
|
|
||||||
private val nameAndLocationComponent = TitledComponentsList(
|
private val nameAndLocationComponent = TitledComponentsList(
|
||||||
listOf(
|
listOf(
|
||||||
StructurePlugin::name.reference.createSettingComponent(context),
|
StructurePlugin::name.reference.createSettingComponent(context),
|
||||||
StructurePlugin::projectPath.reference.createSettingComponent(context),
|
StructurePlugin::projectPath.reference.createSettingComponent(context),
|
||||||
projectTemplateComponent,
|
projectTemplateComponent,
|
||||||
buildSystemSetting
|
buildSystemSetting,
|
||||||
|
jdkComponent
|
||||||
),
|
),
|
||||||
context,
|
context,
|
||||||
stretchY = true,
|
stretchY = true,
|
||||||
@@ -171,7 +173,6 @@ private class PomSettingsComponent(context: Context) : TitledComponentsList(
|
|||||||
class KotlinJpsRuntimeComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizard.context) {
|
class KotlinJpsRuntimeComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizard.context) {
|
||||||
private val componentList = TitledComponentsList(
|
private val componentList = TitledComponentsList(
|
||||||
listOf(
|
listOf(
|
||||||
JdkComponent(ideWizard),
|
|
||||||
KotlinRuntimeComponentComponent(ideWizard)
|
KotlinRuntimeComponentComponent(ideWizard)
|
||||||
),
|
),
|
||||||
ideWizard.context,
|
ideWizard.context,
|
||||||
@@ -187,9 +188,9 @@ private class JdkComponent(ideWizard: IdeWizard) : TitledComponent(ideWizard.con
|
|||||||
ProjectSdksModel().apply { reset(null) },
|
ProjectSdksModel().apply { reset(null) },
|
||||||
Condition(javaModuleBuilder::isSuitableSdkType)
|
Condition(javaModuleBuilder::isSuitableSdkType)
|
||||||
).apply {
|
).apply {
|
||||||
ideWizard.jpsData.jdk = selectedJdk
|
ideWizard.jdk = selectedJdk
|
||||||
addActionListener {
|
addActionListener {
|
||||||
ideWizard.jpsData.jdk = selectedJdk
|
ideWizard.jdk = selectedJdk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user