IDEA-332234 [NPW] new: added icons for all language generators of new project wizard

GitOrigin-RevId: 32c2cc55bc189d8805dffe7dbe8a9ca773a82079
This commit is contained in:
Sergei Vorobyov
2023-12-21 20:25:23 +01:00
committed by intellij-monorepo-bot
parent 4b102d80f0
commit ae7550dccc
11 changed files with 56 additions and 29 deletions

View File

@@ -1,26 +1,31 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.projectWizard.generators
import com.intellij.icons.AllIcons
import com.intellij.ide.JavaUiBundle
import com.intellij.ide.projectWizard.NewProjectWizardCollector.BuildSystem.logBuildSystemChanged
import com.intellij.ide.projectWizard.NewProjectWizardCollector.BuildSystem.logBuildSystemFinished
import com.intellij.ide.projectWizard.NewProjectWizardConstants.Language.JAVA
import com.intellij.ide.wizard.*
import com.intellij.ide.wizard.LanguageNewProjectWizardData.Companion.languageData
import com.intellij.ide.wizard.language.LanguageGeneratorNewProjectWizard
import com.intellij.openapi.project.Project
import com.intellij.ui.dsl.builder.Row
import com.intellij.ui.dsl.builder.SegmentedButton
class JavaNewProjectWizard : LanguageNewProjectWizard {
class JavaNewProjectWizard : LanguageGeneratorNewProjectWizard {
override val name = JAVA
override val icon = AllIcons.Nodes.PpJdk
override val ordinal = 0
override fun createStep(parent: NewProjectWizardLanguageStep) = Step(parent)
override fun createStep(parent: NewProjectWizardStep) = Step(parent)
class Step(parent: NewProjectWizardLanguageStep) :
class Step(parent: NewProjectWizardStep) :
AbstractNewProjectWizardMultiStep<Step, BuildSystemJavaNewProjectWizard>(parent, BuildSystemJavaNewProjectWizard.EP_NAME),
LanguageNewProjectWizardData by parent,
LanguageNewProjectWizardData by parent.languageData!!,
BuildSystemJavaNewProjectWizardData {
override val self = this

View File

@@ -2446,7 +2446,7 @@
<applicationService serviceInterface="com.intellij.openapi.roots.ui.configuration.ModulesConfigurator$NewProjectWizardFactory"
serviceImplementation="com.intellij.openapi.roots.ui.configuration.ModulesConfigurator$NewProjectWizardFactoryImpl"/>
<newProjectWizard.language implementation="com.intellij.ide.projectWizard.generators.JavaNewProjectWizard" order="first"/>
<newProjectWizard.languageGenerator implementation="com.intellij.ide.projectWizard.generators.JavaNewProjectWizard" order="first"/>
<newProjectWizard.java.buildSystem implementation="com.intellij.ide.projectWizard.generators.IntelliJJavaNewProjectWizard"/>
<requiredForSmartModeStartupActivity implementation="com.intellij.ide.projectWizard.generators.SdkPreIndexingRequiredForSmartModeActivity"/>

View File

@@ -15,6 +15,9 @@ interface NewProjectWizardBaseData {
var path: String // canonical
val contentEntryPath: String // canonical
get() = "$path/$name"
@Deprecated(
message = "Unsafe: projectPath throws exception when it isn't validated",
replaceWith = ReplaceWith("Path.of(path, name)", "java.nio.file.Path"),

View File

@@ -1340,7 +1340,7 @@
<notificationGroup id="Groovy DSL errors" displayType="BALLOON" bundle="messages.GroovyBundle" key="notification.group.groovy.dsl"/>
<notificationGroup id="Grape" displayType="BALLOON" bundle="messages.GroovyBundle" key="notification.group.grape"/>
<newProjectWizard.language implementation="org.jetbrains.plugins.groovy.config.wizard.GroovyNewProjectWizard"/>
<newProjectWizard.languageGenerator implementation="org.jetbrains.plugins.groovy.config.wizard.GroovyNewProjectWizard"/>
<newProjectWizard.groovy.buildSystem implementation="org.jetbrains.plugins.groovy.config.wizard.IntelliJGroovyNewProjectWizard"/>
<persistentFsConnectionListener implementation="org.jetbrains.plugins.groovy.bundled.BundledGroovyPersistentFsConnectionListener"/>

View File

@@ -6,23 +6,28 @@ import com.intellij.ide.projectWizard.NewProjectWizardCollector.BuildSystem.logB
import com.intellij.ide.projectWizard.NewProjectWizardCollector.BuildSystem.logBuildSystemFinished
import com.intellij.ide.projectWizard.NewProjectWizardConstants.Language.GROOVY
import com.intellij.ide.wizard.*
import com.intellij.ide.wizard.LanguageNewProjectWizardData.Companion.languageData
import com.intellij.ide.wizard.language.LanguageGeneratorNewProjectWizard
import com.intellij.openapi.observable.properties.GraphProperty
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ui.distribution.DistributionInfo
import com.intellij.ui.dsl.builder.Row
import com.intellij.ui.dsl.builder.SegmentedButton
import icons.JetgroovyIcons
class GroovyNewProjectWizard : LanguageNewProjectWizard {
class GroovyNewProjectWizard : LanguageGeneratorNewProjectWizard {
override val name = GROOVY
override val icon = JetgroovyIcons.Groovy.Groovy_16x16
override val ordinal = 200
override fun createStep(parent: NewProjectWizardLanguageStep) = Step(parent)
override fun createStep(parent: NewProjectWizardStep) = Step(parent)
class Step(parent: NewProjectWizardLanguageStep) :
class Step(parent: NewProjectWizardStep) :
AbstractNewProjectWizardMultiStep<Step, BuildSystemGroovyNewProjectWizard>(parent, BuildSystemGroovyNewProjectWizard.EP_NAME),
LanguageNewProjectWizardData by parent,
LanguageNewProjectWizardData by parent.languageData!!,
BuildSystemGroovyNewProjectWizardData {
override val self: Step = this

View File

@@ -25,7 +25,7 @@
<applicationService serviceImplementation="org.jetbrains.kotlin.tools.projectWizard.compatibility.DependencyVersionStore"/>
<applicationService serviceImplementation="org.jetbrains.kotlin.tools.projectWizard.compatibility.KotlinWizardVersionStore"/>
<applicationService serviceImplementation="org.jetbrains.kotlin.tools.projectWizard.compatibility.KotlinGradleCompatibilityStore"/>
<newProjectWizard.language implementation="org.jetbrains.kotlin.tools.projectWizard.KotlinNewProjectWizard"/>
<newProjectWizard.languageGenerator implementation="org.jetbrains.kotlin.tools.projectWizard.KotlinNewProjectWizard"/>
<newProjectWizard.kotlin.buildSystem implementation="org.jetbrains.kotlin.tools.projectWizard.IntelliJKotlinNewProjectWizard"/>
</extensions>

View File

@@ -6,12 +6,15 @@ import com.intellij.ide.projectWizard.NewProjectWizardCollector.BuildSystem.logB
import com.intellij.ide.projectWizard.NewProjectWizardCollector.BuildSystem.logBuildSystemFinished
import com.intellij.ide.projectWizard.NewProjectWizardConstants.Language.KOTLIN
import com.intellij.ide.wizard.*
import com.intellij.ide.wizard.LanguageNewProjectWizardData.Companion.languageData
import com.intellij.ide.wizard.language.LanguageGeneratorNewProjectWizard
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.LibraryOrderEntry
import com.intellij.ui.dsl.builder.*
import com.intellij.util.SystemProperties
import com.intellij.util.ui.JBUI
import org.jetbrains.kotlin.idea.KotlinIcons
import org.jetbrains.kotlin.tools.projectWizard.core.Context
import org.jetbrains.kotlin.tools.projectWizard.core.asPath
import org.jetbrains.kotlin.tools.projectWizard.core.entity.settings.reference
@@ -30,10 +33,12 @@ import org.jetbrains.kotlin.tools.projectWizard.wizard.NewProjectWizardModuleBui
import org.jetbrains.plugins.gradle.service.GradleInstallationManager
import java.util.*
class KotlinNewProjectWizard : LanguageNewProjectWizard {
class KotlinNewProjectWizard : LanguageGeneratorNewProjectWizard {
override val name = KOTLIN
override val icon = KotlinIcons.SMALL_LOGO
override val ordinal = 100
companion object {
@@ -111,11 +116,11 @@ class KotlinNewProjectWizard : LanguageNewProjectWizard {
// Uncommenting this line disables new Kotlin modules
//override fun isEnabled(context: WizardContext): Boolean = context.isCreatingNewProject
override fun createStep(parent: NewProjectWizardLanguageStep) = Step(parent)
override fun createStep(parent: NewProjectWizardStep) = Step(parent)
class Step(parent: NewProjectWizardLanguageStep) :
class Step(parent: NewProjectWizardStep) :
AbstractNewProjectWizardMultiStep<Step, BuildSystemKotlinNewProjectWizard>(parent, BuildSystemKotlinNewProjectWizard.EP_NAME),
LanguageNewProjectWizardData by parent,
LanguageNewProjectWizardData by parent.languageData!!,
BuildSystemKotlinNewProjectWizardData {
override val self = this

View File

@@ -5,7 +5,7 @@
<xi:include href="/META-INF/python-community-plugin-core.xml" xpointer="xpointer(/idea-plugin/*)"/>
<extensions defaultExtensionNs="com.intellij">
<newProjectWizard.language implementation="com.jetbrains.python.newProject.PythonNewProjectWizard"/>
<newProjectWizard.languageGenerator implementation="com.jetbrains.python.newProject.PythonNewProjectWizard"/>
<moduleType id="PYTHON_MODULE" implementationClass="com.jetbrains.python.module.PythonModuleType"/>
<facetType implementation="com.jetbrains.python.facet.PythonFacetType"/>
<frameworkSupport implementation="com.jetbrains.python.facet.PythonFrameworkSupportProvider"/>

View File

@@ -5,6 +5,8 @@ import com.intellij.ide.highlighter.ModuleFileType
import com.intellij.ide.projectWizard.NewProjectWizardConstants.Language.PYTHON
import com.intellij.ide.util.projectWizard.WizardContext
import com.intellij.ide.wizard.*
import com.intellij.ide.wizard.NewProjectWizardBaseData.Companion.baseData
import com.intellij.ide.wizard.language.LanguageGeneratorNewProjectWizard
import com.intellij.openapi.Disposable
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.ModuleManager
@@ -28,6 +30,7 @@ import com.jetbrains.python.sdk.add.PyAddNewCondaEnvPanel
import com.jetbrains.python.sdk.add.PyAddNewVirtualEnvPanel
import com.jetbrains.python.sdk.add.PyAddSdkPanel
import com.jetbrains.python.sdk.pythonSdk
import icons.PythonIcons
import java.nio.file.Path
/**
@@ -35,13 +38,15 @@ import java.nio.file.Path
*
* It suggests creating a new Python virtual environment for your new project to follow Python best practices.
*/
class PythonNewProjectWizard : LanguageNewProjectWizard {
class PythonNewProjectWizard : LanguageGeneratorNewProjectWizard {
override val name = PYTHON
override val icon = PythonIcons.Python.Python
override val ordinal = 600
override fun createStep(parent: NewProjectWizardLanguageStep): NewProjectWizardStep = NewPythonProjectStep(parent)
override fun createStep(parent: NewProjectWizardStep): NewProjectWizardStep = NewPythonProjectStep(parent)
}
/**
@@ -84,11 +89,10 @@ interface NewProjectWizardPythonData : NewProjectWizardBaseData {
* It works for both PyCharm (where the *.iml file resides in .idea/ directory and the SDK is set for the project) and other
* IntelliJ-based IDEs (where the *.iml file resides in the module directory and the SDK is set for the module).
*/
class NewPythonProjectStep<P>(parent: P)
class NewPythonProjectStep(parent: NewProjectWizardStep)
: AbstractNewProjectWizardStep(parent),
NewProjectWizardBaseData by parent,
NewProjectWizardPythonData
where P : NewProjectWizardStep, P : NewProjectWizardBaseData {
NewProjectWizardBaseData by parent.baseData!!,
NewProjectWizardPythonData {
override val pythonSdkProperty = propertyGraph.property<Sdk?>(null)
override var pythonSdk by pythonSdkProperty
@@ -96,7 +100,7 @@ class NewPythonProjectStep<P>(parent: P)
get() = intellijModule ?: context.project?.let { ModuleManager.getInstance(it).modules.firstOrNull() }
private var intellijModule: Module? = null
private val sdkStep: PythonSdkStep<NewPythonProjectStep<P>> by lazy { PythonSdkStep(this) }
private val sdkStep: PythonSdkStep<NewPythonProjectStep> by lazy { PythonSdkStep(this) }
override fun setupUI(builder: Panel) {
sdkStep.setupUI(builder)

View File

@@ -39,6 +39,6 @@
<metaLanguage implementation="com.intellij.lang.html.HtmlCompatibleMetaLanguage"/>
<html.compatibleLanguage language="HTML"/>
<completion.htmlInTextCompletionEnabler implementation="com.intellij.codeInsight.completion.HtmlNoBracketCompletionEnablerImpl"/>
<newProjectWizard.language id="html" order="last" implementation="com.intellij.ide.wizard.HTMLNewProjectWizard"/>
<newProjectWizard.languageGenerator id="html" order="last" implementation="com.intellij.ide.wizard.HTMLNewProjectWizard"/>
</extensions>
</idea-plugin>

View File

@@ -1,10 +1,13 @@
// 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 com.intellij.ide.wizard
import com.intellij.icons.AllIcons
import com.intellij.ide.actions.CreateFileFromTemplateAction
import com.intellij.ide.fileTemplates.FileTemplateManager
import com.intellij.ide.projectWizard.NewProjectWizardConstants.Language.HTML
import com.intellij.ide.util.projectWizard.WizardContext
import com.intellij.ide.wizard.NewProjectWizardBaseData.Companion.baseData
import com.intellij.ide.wizard.language.LanguageGeneratorNewProjectWizard
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.module.WebModuleBuilder
import com.intellij.openapi.project.Project
@@ -17,17 +20,19 @@ import com.intellij.ui.dsl.builder.bindSelected
import com.intellij.util.PlatformUtils
import com.intellij.xml.XmlBundle
class HTMLNewProjectWizard : LanguageNewProjectWizard {
class HTMLNewProjectWizard : LanguageGeneratorNewProjectWizard {
override val name = HTML
override val icon = AllIcons.Nodes.PpWeb
override val ordinal = 400
override fun isEnabled(context: WizardContext) = PlatformUtils.isCommunityEdition()
override fun createStep(parent: NewProjectWizardLanguageStep) = Step(parent)
override fun createStep(parent: NewProjectWizardStep) = Step(parent)
class Step(private val parent: NewProjectWizardLanguageStep) : AbstractNewProjectWizardStep(parent) {
class Step(parent: NewProjectWizardStep) : AbstractNewProjectWizardStep(parent) {
private val addSampleCode = propertyGraph.property(false)
@@ -42,8 +47,8 @@ class HTMLNewProjectWizard : LanguageNewProjectWizard {
override fun setupProject(project: Project) {
val builder = WebModuleBuilder<Any>().also {
it.name = parent.name
it.contentEntryPath = "${parent.path}/${parent.name}"
it.name = baseData!!.name
it.contentEntryPath = baseData!!.contentEntryPath
}
setupProjectFromBuilder(project, builder)