i18n: Add bundle for idea-new-project-wizard

This commit is contained in:
Yan Zhulanow
2020-02-19 21:17:14 +09:00
committed by Dmitry Gridin
parent f1d21b02e9
commit 4e634b2b01
14 changed files with 158 additions and 66 deletions
@@ -0,0 +1,55 @@
setting.build.system.label=Build System
step.module.type=Module Type
step.target=Target
generator.title=Kotlin (Experimental Wizard)
editor.project=Project
editor.dependencies=Dependencies
editor.add=Add
editor.configure=Configure
editor.add.target=Add Target
editor.add.generic.module=Add Module
editor.add.javascript.module=Add JS Module
editor.remove.module.title=Remove selected module
editor.remove.target.title=Remove selected target
editor.remove.module.description=Do you want to remove selected module?
editor.remove.target.description=Do you want to remove selected target?
editor.remove.module.toolbutton=Remove module
editor.remove.target.toolbutton=Remove target
editor.remove.button.remove=Remove
editor.remove.button.cancel=Cancel
editor.remove.all.submodules=This will also remove all submodules.
editor.cant.undone.action=This action cannot be undone.
editor.remove.template.title=Remove selected template
editor.remove.template.description=Do you want to remove selected template from module?
editor.no.modules.created=No modules created
editor.add.module.to.project=Add a module to the project
editor.no.configurable.settings=This module has no settings to configure
editor.no.dependencies.to.add=There are no dependencies to add
editor.select.dependency.modules=Select the modules to add as dependencies:
editor.choose.modules=Choose Modules
editor.entity.module.name=Module name
editor.entity.project.name=Project name
error.following=The following errors arose during project generation
error.invalid.project.name=Invalid project name
error.validation=Validation error
error.nothing.selected=Neither module nor source set is selected
editor.field.name=Name
editor.tab.template=Template
editor.tab.module.settings=Module settings
editor.template.can.configure.template=You can configure a template for selected module
editor.template.no.templates.available=No templates available for the selected module
editor.template.select.module=You can configure a template for selected module
editor.template.choose=Choose a template to configure
editor.template.remove=Remove template
@@ -0,0 +1,24 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.tools.projectWizard.wizard
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
object KotlinNewProjectWizardBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
}
@@ -59,8 +59,11 @@ class NewProjectWizardModuleBuilder : EmptyModuleBuilder() {
companion object {
const val MODULE_BUILDER_ID = "kotlin.newProjectWizard.builder"
private const val DEFAULT_GROUP_ID = "me.user"
private val projectNameValidator = StringValidators.shouldBeValidIdentifier("Project name", setOf('-', '_'))
private const val INVALID_PROJECT_NAME_MESSAGE = "Invalid project name"
private val projectNameValidator = StringValidators.shouldBeValidIdentifier(
KotlinNewProjectWizardBundle.message("editor.entity.project.name"),
setOf('-', '_')
)
private val INVALID_PROJECT_NAME_MESSAGE = KotlinNewProjectWizardBundle.message("error.invalid.project.name")
}
override fun isAvailable(): Boolean = ExperimentalFeatures.NewWizard.isEnabled
@@ -91,7 +94,7 @@ class NewProjectWizardModuleBuilder : EmptyModuleBuilder() {
phases = GenerationPhase.startingFrom(GenerationPhase.FIRST_STEP)
).onFailure { errors ->
val errorMessages = errors.joinToString(separator = "\n") { it.message }
Messages.showErrorDialog(project, errorMessages, "The following errors arose during project generation")
Messages.showErrorDialog(project, errorMessages, KotlinNewProjectWizardBundle.message("error.following"))
}.isSuccess
if (success) {
val projectCreationStats = ProjectCreationStats(
@@ -182,7 +185,7 @@ abstract class WizardStep(protected val wizard: IdeWizard, private val phase: Ge
when (val result = with(wizard.valuesReadingContext) { with(wizard) { validate(setOf(phase)) } }) {
is Success<*> -> true
is Failure -> {
throw ConfigurationException(result.asHtml(), "Validation Error")
throw ConfigurationException(result.asHtml(), KotlinNewProjectWizardBundle.message("error.validation"))
}
}
}
@@ -5,7 +5,7 @@ import org.jetbrains.kotlin.idea.KotlinIcons
import javax.swing.Icon
class NewProjectWizardModuleType : ModuleType<NewProjectWizardModuleBuilder>(NewProjectWizardModuleBuilder.MODULE_BUILDER_ID) {
override fun getName(): String = "Kotlin (Experimental Wizard)"
override fun getName(): String = KotlinNewProjectWizardBundle.message("generator.title")
override fun getDescription(): String = name
override fun getNodeIcon(isOpened: Boolean): Icon = KotlinIcons.SMALL_LOGO
override fun createModuleBuilder(): NewProjectWizardModuleBuilder = NewProjectWizardModuleBuilder()
@@ -6,12 +6,12 @@ import icons.OpenapiIcons
import org.jetbrains.kotlin.idea.KotlinIcons
import org.jetbrains.kotlin.tools.projectWizard.core.entity.DropDownSettingType
import org.jetbrains.kotlin.tools.projectWizard.core.entity.SettingReference
import org.jetbrains.kotlin.tools.projectWizard.core.context.ReadingContext
import org.jetbrains.kotlin.tools.projectWizard.core.entity.reference
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemPlugin
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.KotlinPlugin
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeContext
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.components.DropDownComponent
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.setting.UIComponentDelegatingSettingComponent
@@ -25,7 +25,7 @@ class BuildSystemTypeSettingComponent(
override val uiComponent: DropDownComponent<BuildSystemType> = DropDownComponent(
ideContext,
setting.type.values,
labelText = "Build System",
labelText = KotlinNewProjectWizardBundle.message("setting.build.system.label"),
filter = { value -> read { setting.type.filter(this, reference, value) } },
validator = setting.validator,
iconProvider = BuildSystemType::icon,
@@ -2,7 +2,6 @@ package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep
import com.intellij.ui.components.JBTabbedPane
import org.jetbrains.kotlin.idea.projectWizard.UiEditorUsageStats
import org.jetbrains.kotlin.tools.projectWizard.core.context.ReadingContext
import org.jetbrains.kotlin.tools.projectWizard.core.entity.StringValidators
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.getConfiguratorSettings
@@ -12,6 +11,7 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module.Companion.ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.ModuleKind
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeContext
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.DynamicComponent
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.components.TextFieldComponent
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.panel
@@ -23,16 +23,18 @@ class ModuleSettingsComponent(
ideContext: IdeContext,
uiEditorUsagesStats: UiEditorUsageStats
) : DynamicComponent(ideContext) {
private val validateModuleName =
StringValidators.shouldNotBeBlank("Module name") and
StringValidators.shouldBeValidIdentifier("Module Name", ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES)
private val validateModuleName = run {
val entityName = KotlinNewProjectWizardBundle.message("editor.entity.module.name")
StringValidators.shouldNotBeBlank(entityName) and
StringValidators.shouldBeValidIdentifier(entityName, ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES)
}
private val moduleConfiguratorSettingsList = SettingsList(emptyList(), ideContext).asSubComponent()
private val templateComponent = TemplatesComponent(ideContext, uiEditorUsagesStats).asSubComponent()
private val tabPanel = JBTabbedPane().apply {
add("Template", templateComponent.component)
add("Module Settings", moduleConfiguratorSettingsList.component)
add(KotlinNewProjectWizardBundle.message("editor.tab.template"), templateComponent.component)
add(KotlinNewProjectWizardBundle.message("editor.tab.module.settings"), moduleConfiguratorSettingsList.component)
}
fun selectSettingWithError(error: ValidationResult.ValidationError) {
@@ -44,7 +46,7 @@ class ModuleSettingsComponent(
private val nameField = TextFieldComponent(
ideContext,
labelText = "Name",
labelText = KotlinNewProjectWizardBundle.message("editor.field.name"),
onValueUpdate = { value ->
module?.name = value
ideContext.eventManager.fireListeners(null)
@@ -1,5 +1,6 @@
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.Component
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.PanelWithStatusText
import java.awt.BorderLayout
@@ -7,7 +8,7 @@ import java.awt.BorderLayout
class NothingSelectedComponent : Component() {
override val component = PanelWithStatusText(
BorderLayout(),
"Neither Module nor Sourceset is selected",
KotlinNewProjectWizardBundle.message("error.nothing.selected"),
isStatusTextVisible = true
)
}
@@ -5,13 +5,13 @@ import com.intellij.openapi.ui.DialogWrapper
import com.intellij.ui.ColoredListCellRenderer
import com.intellij.ui.SimpleTextAttributes
import com.intellij.ui.ToolbarDecorator
import org.jetbrains.kotlin.tools.projectWizard.core.context.ReadingContext
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.AndroidSinglePlatformModuleConfigurator
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.IOSSinglePlatformModuleConfigurator
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.KotlinPlugin
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.*
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeContext
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.*
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import java.awt.BorderLayout
@@ -71,7 +71,7 @@ class SourcesetDependenciesSettingsComponent(
private class ChooseModuleDialog(modules: List<Module>, parent: JComponent) : DialogWrapper(parent, false) {
private val list = ImmutableSingleSelectableListWithIcon(
values = modules,
emptyMessage = "There are no dependencies to add",
emptyMessage = KotlinNewProjectWizardBundle.message("editor.no.dependencies.to.add"),
renderValue = { value ->
renderModule(value)
}
@@ -80,7 +80,7 @@ private class ChooseModuleDialog(modules: List<Module>, parent: JComponent) : Di
override fun createCenterPanel() = panel {
preferredSize = Dimension(preferredSize.width, 300)
add(
label("Please select the modules to add as dependencies:")
label(KotlinNewProjectWizardBundle.message("editor.select.dependency.modules"))
.bordered(
needLineBorder = false,
needInnerEmptyBorder = false,
@@ -95,7 +95,7 @@ private class ChooseModuleDialog(modules: List<Module>, parent: JComponent) : Di
get() = list.selectedValue
init {
title = "Choose Modules"
title = KotlinNewProjectWizardBundle.message("editor.choose.modules")
init()
}
}
@@ -1,16 +1,16 @@
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep
import com.intellij.ui.components.JBTabbedPane
import org.jetbrains.kotlin.tools.projectWizard.core.context.ReadingContext
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Sourceset
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeContext
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.DynamicComponent
class SourcesetSettingsComponent(ideContext: IdeContext) : DynamicComponent(ideContext) {
private val dependenciesComponent = SourcesetDependenciesSettingsComponent(ideContext).asSubComponent()
override val component = JBTabbedPane().apply {
add("Dependencies", dependenciesComponent.component)
add(KotlinNewProjectWizardBundle.message("editor.dependencies"), dependenciesComponent.component)
}
var sourceset: Sourceset? = null
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module
import org.jetbrains.kotlin.tools.projectWizard.templates.Template
import org.jetbrains.kotlin.tools.projectWizard.templates.settings
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeContext
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.*
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.Component
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.setting.ErrorAwareComponent
@@ -40,10 +41,10 @@ class TemplatesComponent(
private val templateSettingsComponent = TemplateSettingsComponent(ideContext) {
if (MessagesEx.showOkCancelDialog(
component,
"Do you want to remove selected template from module",
"Remove selected template",
"Remove",
"Cancel",
KotlinNewProjectWizardBundle.message("editor.remove.template.description"),
KotlinNewProjectWizardBundle.message("editor.remove.template.title"),
KotlinNewProjectWizardBundle.message("editor.remove.button.remove"),
KotlinNewProjectWizardBundle.message("editor.remove.button.cancel"),
null
) == Messages.OK
) {
@@ -89,9 +90,9 @@ class ChooseTemplateComponent(
private val onTemplateChosen: (Template) -> Unit
) : DynamicComponent(ideContext) {
private enum class State(val text: String) {
MODULE_SELECTED_AND_TEMPLATES_AVAILABLE("You can configure a template for selected module"),
MODULE_SELECTED_AND_NO_TEMPLATES_AVAILABLE("No templates available for selected module"),
NO_MODULE_SELECTED("Please select a module to configure")
MODULE_SELECTED_AND_TEMPLATES_AVAILABLE(KotlinNewProjectWizardBundle.message("editor.template.can.configure.template")),
MODULE_SELECTED_AND_NO_TEMPLATES_AVAILABLE(KotlinNewProjectWizardBundle.message("editor.template.no.templates.available")),
NO_MODULE_SELECTED(KotlinNewProjectWizardBundle.message("editor.template.select.module"))
}
override val component: JPanel = object : JPanel() {
@@ -137,7 +138,7 @@ class ChooseTemplateComponent(
statusText.clear()
statusText.appendText(state.text)
if (state == State.MODULE_SELECTED_AND_TEMPLATES_AVAILABLE) {
statusText.appendSecondaryText("Configure", SimpleTextAttributes.LINK_ATTRIBUTES) {
statusText.appendSecondaryText(KotlinNewProjectWizardBundle.message("editor.configure"), SimpleTextAttributes.LINK_ATTRIBUTES) {
showDialog()
}
}
@@ -147,7 +148,7 @@ class ChooseTemplateComponent(
private fun showDialog() {
val availableTemplates = availableTemplates
if (availableTemplates.isEmpty()) {
MessagesEx.error(null, "No templates available for the selected module")
MessagesEx.error(null, KotlinNewProjectWizardBundle.message("editor.template.no.templates.available"))
} else {
val dialog = TemplateListDialog(availableTemplates, component)
if (dialog.showAndGet()) {
@@ -184,7 +185,7 @@ private class TemplateListDialog(
get() = templatesList.selectedValue
init {
title = "Choose a template to configure"
title = KotlinNewProjectWizardBundle.message("editor.template.choose")
init()
if (values.isNotEmpty()) {
templateDescriptionComponent.updateSelectedTemplate(values.first())
@@ -208,7 +209,7 @@ class TemplateDescriptionComponent(
onRemoveButtonClicked: () -> Unit = {}
) : Component() {
private val removeButton = if (needRemoveButton) {
hyperlinkLabel("Remove template", onClick = onRemoveButtonClicked)
hyperlinkLabel(KotlinNewProjectWizardBundle.message("editor.template.remove"), onClick = onRemoveButtonClicked)
} else null
private val titleLabel = label("", bold = true) {
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.ModuleSubType
import org.jetbrains.kotlin.tools.projectWizard.settings.DisplayableSettingItem
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.*
import org.jetbrains.kotlin.tools.projectWizard.settings.fullText
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.asHtml
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.htmlText
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.icon
@@ -39,7 +40,7 @@ class CreateModuleOrTargetPopup private constructor(
}
private inner class ChooseModuleOrMppModuleStep : BaseListPopupStep<ModuleConfigurator>(
"Module Type",
KotlinNewProjectWizardBundle.message("step.module.type"),
buildList {
if (allowMultiplatform) +MppModuleConfigurator
+JvmSinglePlatformModuleConfigurator
@@ -67,7 +68,7 @@ class CreateModuleOrTargetPopup private constructor(
targetConfiguratorGroup: TargetConfiguratorGroupWithSubItems,
showTitle: Boolean
) : BaseListPopupStep<DisplayableSettingItem>(
"Target".takeIf { showTitle },
KotlinNewProjectWizardBundle.message("step.target").takeIf { showTitle },
targetConfiguratorGroup.subItems.filter { it.needToShow() }
) {
override fun getIconFor(value: DisplayableSettingItem): Icon? = when (value) {
@@ -7,6 +7,7 @@ import com.intellij.ui.ToolbarDecorator
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.*
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.*
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.createPanelWithPopupHandler
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import javax.swing.JComponent
@@ -51,31 +52,40 @@ class ModulesEditorToolbarDecorator(
null -> true
else -> false
}
text = "Add" + when (tree.selectedSettingItem?.safeAs<Module>()?.kind) {
ModuleKind.multiplatform -> " Target"
ModuleKind.singleplatformJvm -> " Module"
ModuleKind.singleplatformJs -> " JS Module"
ModuleKind.target -> ""
null -> ""
text = when (tree.selectedSettingItem?.safeAs<Module>()?.kind) {
ModuleKind.multiplatform -> KotlinNewProjectWizardBundle.message("editor.add.target")
ModuleKind.singleplatformJvm -> KotlinNewProjectWizardBundle.message("editor.add.generic.module")
ModuleKind.singleplatformJs -> KotlinNewProjectWizardBundle.message("editor.add.javascript.module")
ModuleKind.target -> KotlinNewProjectWizardBundle.message("editor.add")
null -> KotlinNewProjectWizardBundle.message("editor.add")
}
}
event.presentation.isEnabled
}
setRemoveAction {
val moduleKindText = selectedModuleKindText ?: "Module"
val title = when (selectedModuleKind) {
ModuleKind.target -> KotlinNewProjectWizardBundle.message("editor.remove.target.title")
else -> KotlinNewProjectWizardBundle.message("editor.remove.module.title")
}
val description = when (selectedModuleKind) {
ModuleKind.target -> KotlinNewProjectWizardBundle.message("editor.remove.target.description")
else -> KotlinNewProjectWizardBundle.message("editor.remove.module.description")
}
if (Messages.showOkCancelDialog(
tree,
buildString {
appendln("Do you want to remove selected $moduleKindText?")
appendln(description)
if (tree.selectedSettingItem.safeAs<Module>()?.kind != ModuleKind.target) {
appendln("This will also remove all submodules.")
appendln(KotlinNewProjectWizardBundle.message("editor.remove.all.submodules"))
}
appendln()
appendln("This action cannot be undone.")
appendln(KotlinNewProjectWizardBundle.message("editor.cant.undone.action"))
},
"Remove selected $moduleKindText?",
"Remove",
"Cancel",
title,
KotlinNewProjectWizardBundle.message("editor.remove.button.remove"),
KotlinNewProjectWizardBundle.message("editor.remove.button.cancel"),
AllIcons.General.QuestionDialog
) == Messages.OK
) {
@@ -85,7 +95,10 @@ class ModulesEditorToolbarDecorator(
setRemoveActionUpdater { event ->
event.presentation.apply {
isEnabled = tree.selectedSettingItem is Module
text = "Remove" + selectedModuleKindText?.let { " $it" }.orEmpty()
text = when (selectedModuleKind) {
ModuleKind.target -> KotlinNewProjectWizardBundle.message("editor.remove.target.toolbutton")
else -> KotlinNewProjectWizardBundle.message("editor.remove.module.toolbutton")
}
}
event.presentation.isEnabled
}
@@ -94,20 +107,12 @@ class ModulesEditorToolbarDecorator(
setMoveUpAction(null)
}
private val selectedModuleKindText
get() = tree.selectedSettingItem.safeAs<Module>()?.kindText
private val selectedModuleKind
get() = tree.selectedSettingItem.safeAs<Module>()?.kind
fun createToolPanel(): JComponent = toolbarDecorator
.createPanelWithPopupHandler(tree)
.apply {
border = null
}
}
private val Module.kindText
get() = when (kind) {
ModuleKind.multiplatform -> "Module"
ModuleKind.singleplatformJvm -> "Module"
ModuleKind.singleplatformJs -> "Module"
ModuleKind.target -> "Target"
}
}
@@ -8,6 +8,7 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.DisplayableSettingItem
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Sourceset
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.path
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.icon
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import javax.swing.JComponent
@@ -63,9 +64,9 @@ class ModulesEditorTree(
}
emptyText.clear()
emptyText.appendText("No modules created")
emptyText.appendText(KotlinNewProjectWizardBundle.message("editor.no.modules.created"))
emptyText.appendSecondaryText(
"Add a module to the project",
KotlinNewProjectWizardBundle.message("editor.add.module.to.project"),
SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES
) {
addModule(this)
@@ -83,11 +84,10 @@ class ModulesEditorTree(
) {
if (value?.safeAs<DefaultMutableTreeNode>()?.userObject == PROJECT_USER_OBJECT) {
icon = AllIcons.Nodes.Project
append("Project")
append(KotlinNewProjectWizardBundle.message("editor.project"))
return
}
val setting = (value as? DefaultMutableTreeNode)?.userObject as? DisplayableSettingItem
?: return
val setting = (value as? DefaultMutableTreeNode)?.userObject as? DisplayableSettingItem ?: return
icon = when (setting) {
is Module -> setting.icon
is Sourceset -> AllIcons.Nodes.Module
@@ -1,11 +1,11 @@
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.setting
import com.intellij.ui.components.panels.VerticalLayout
import org.jetbrains.kotlin.tools.projectWizard.core.context.ReadingContext
import org.jetbrains.kotlin.tools.projectWizard.core.entity.SettingReference
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
import org.jetbrains.kotlin.tools.projectWizard.core.entity.isSpecificError
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeContext
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.DynamicComponent
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.FocusableComponent
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.PanelWithStatusText
@@ -19,7 +19,7 @@ class SettingsList(
settings: List<SettingReference<*, *>>,
private val ideContext: IdeContext
) : DynamicComponent(ideContext), ErrorAwareComponent {
private val panel = PanelWithStatusText(VerticalLayout(5), "This module has no settings to configure")
private val panel = PanelWithStatusText(VerticalLayout(5), KotlinNewProjectWizardBundle.message("editor.no.configurable.settings"))
var settingComponents: List<SettingComponent<*, *>> = emptyList()
private set