blob: 8f15ef4e0df0772bfa9c235ee49b3e8e62209a7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.tools.projectWizard
import com.intellij.ide.JavaUiBundle
import com.intellij.ide.wizard.AbstractNewProjectWizardStep
import com.intellij.openapi.module.StdModuleTypes
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.JavaSdkType
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.projectRoots.SdkTypeId
import com.intellij.openapi.projectRoots.impl.DependentSdkType
import com.intellij.openapi.roots.ui.configuration.sdkComboBox
import com.intellij.ui.UIBundle.*
import com.intellij.ui.dsl.builder.*
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType
internal class IntelliJKotlinNewProjectWizard : BuildSystemKotlinNewProjectWizard {
override val name = "IntelliJ"
override fun createStep(parent: KotlinNewProjectWizard.Step) = object : AbstractNewProjectWizardStep(parent) {
private val sdkProperty = propertyGraph.property<Sdk?>(null)
private val addSampleCodeProperty = propertyGraph.property(false)
private val sdk by sdkProperty
private val addSampleCode by addSampleCodeProperty
override fun setupUI(builder: Panel) {
with(builder) {
row(JavaUiBundle.message("label.project.wizard.new.project.jdk")) {
val sdkTypeFilter = { it: SdkTypeId -> it is JavaSdkType && it !is DependentSdkType }
sdkComboBox(context, sdkProperty, StdModuleTypes.JAVA.id, sdkTypeFilter)
.columns(COLUMNS_MEDIUM)
}
row {
checkBox(message("label.project.wizard.new.project.add.sample.code"))
.bindSelected(addSampleCodeProperty)
}.topGap(TopGap.SMALL)
}
}
override fun setupProject(project: Project) =
KotlinNewProjectWizard.generateProject(
project = project,
projectPath = "${parent.path}/${parent.name}",
projectName = parent.name,
sdk = sdk,
buildSystemType = BuildSystemType.Jps,
addSampleCode = addSampleCode
)
}
}
|