Wizard: move UI texts to bundles
This commit is contained in:
+5
-55
@@ -1,55 +1,5 @@
|
||||
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
|
||||
module.kind.android.module=Android Module
|
||||
module.kind.js.module=JS Module
|
||||
module.kind.module=Module
|
||||
module.kind.mpp.module=MPP Module
|
||||
module.kind.target=Target
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
generator.title=Kotlin (Experimental Wizard)
|
||||
|
||||
error.nothing.selected=Neither module nor source set is selected
|
||||
project.preview=Preview
|
||||
|
||||
additional.buildsystem.settings.kotlin.runtime=Kotlin Runtime
|
||||
additional.buildsystem.settings.project.jdk=Project JDK
|
||||
additional.buildsystem.settings.artifact.coordinates=Artifact Coordinates
|
||||
|
||||
module.dependencies.module.dependencies=Module dependencies
|
||||
module.dependencies.add.module.dependency=Add module dependency
|
||||
module.dependencies.remove.module.dependency=Remove module dependency
|
||||
|
||||
editor.modules.remove.selected.module=Do you want to remove selected {0}
|
||||
editor.modules.remove.selected.submodules=This will also remove all submodules.
|
||||
editor.modules.remove.selected.no.undone=This action cannot be undone.
|
||||
editor.modules.remove.selected.question=Remove selected {0}?
|
||||
editor.modules.remove.selected.remove=Remove
|
||||
editor.modules.remove.selected.cancel=Cancel
|
||||
editor.modules.remove.tooltip=Remove {0}
|
||||
|
||||
editor.modules.project=Project
|
||||
editor.modules.add.module=Add a module to the project
|
||||
editor.modules.no.modules=No modules created
|
||||
|
||||
module.settings.name=Name
|
||||
module.settings.name.same.as.project=[The same as the project name]
|
||||
module.settings.name.can.not.be.modified=[Can not be modified]
|
||||
module.settings.name.module.name=Module name
|
||||
|
||||
module.settings.template=Template
|
||||
module.settings.template.none=None
|
||||
|
||||
version.provider.downloading.kotlin.version=Downloading Kotlin version
|
||||
module.settings.dependencies.empty=There is no module dependencies
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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 org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
import org.jetbrains.kotlin.util.AbstractKotlinBundle
|
||||
|
||||
@NonNls
|
||||
private const val BUNDLE = "messages.KotlinNewProjectWizardUIBundle"
|
||||
|
||||
object KotlinNewProjectWizardUIBundle : AbstractKotlinBundle(BUNDLE) {
|
||||
@JvmStatic
|
||||
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
|
||||
}
|
||||
+1
-1
@@ -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 = KotlinNewProjectWizardBundle.message("generator.title")
|
||||
override fun getName(): String = KotlinNewProjectWizardUIBundle.message("generator.title")
|
||||
override fun getDescription(): String = name
|
||||
override fun getNodeIcon(isOpened: Boolean): Icon = KotlinIcons.SMALL_LOGO
|
||||
override fun createModuleBuilder(): NewProjectWizardModuleBuilder = NewProjectWizardModuleBuilder()
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.tools.projectWizard.wizard.service
|
||||
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.service.BuildSystemAvailabilityWizardService
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.isGradle
|
||||
@@ -18,6 +19,6 @@ class IdeaBuildSystemAvailabilityWizardService : BuildSystemAvailabilityWizardSe
|
||||
else -> true
|
||||
}
|
||||
|
||||
private fun isPluginEnabled(id: String) =
|
||||
private fun isPluginEnabled(@NonNls id: String) =
|
||||
PluginManagerCore.getPlugin(PluginId.getId(id))?.isEnabled == true
|
||||
}
|
||||
+2
@@ -14,6 +14,7 @@ import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExe
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.TaskResult
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.andThen
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.safe
|
||||
@@ -69,6 +70,7 @@ class IdeaGradleWizardService(private val project: Project) : ProjectImportingWi
|
||||
}
|
||||
|
||||
companion object {
|
||||
@NonNls
|
||||
private const val WRAPPER_TASK_NAME = "wrapper"
|
||||
}
|
||||
}
|
||||
+16
-9
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.tools.projectWizard.wizard.service
|
||||
|
||||
import com.intellij.util.text.VersionComparatorUtil
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.idea.framework.ui.ConfigureDialogWithModulesAndVersion
|
||||
import org.jetbrains.kotlin.tools.projectWizard.Versions
|
||||
@@ -15,6 +16,7 @@ import org.jetbrains.kotlin.tools.projectWizard.core.compute
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.safe
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.service.KotlinVersionProviderService
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.version.Version
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.runWithProgressBar
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
@@ -33,22 +35,24 @@ class IdeaKotlinVersionProviderService : KotlinVersionProviderService, IdeaWizar
|
||||
?.let { Version.fromString(it) }
|
||||
|
||||
companion object {
|
||||
@NonNls
|
||||
private const val SNAPSHOT_TAG = "snapshot"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private object VersionsDownloader {
|
||||
fun downloadLatestEapOrStableKotlinVersion(): Version? = runWithProgressBar("Downloading Kotlin version") {
|
||||
val latestEap = EapVersionDownloader.getLatestEapVersion()
|
||||
val latestStable = getLatestStableVersion()
|
||||
when {
|
||||
latestEap == null -> latestStable
|
||||
latestStable == null -> latestEap
|
||||
VersionComparatorUtil.compare(latestEap.text, latestStable.text) > 0 -> latestEap
|
||||
else -> latestStable
|
||||
fun downloadLatestEapOrStableKotlinVersion(): Version? =
|
||||
runWithProgressBar(KotlinNewProjectWizardUIBundle.message("version.provider.downloading.kotlin.version")) {
|
||||
val latestEap = EapVersionDownloader.getLatestEapVersion()
|
||||
val latestStable = getLatestStableVersion()
|
||||
when {
|
||||
latestEap == null -> latestStable
|
||||
latestStable == null -> latestEap
|
||||
VersionComparatorUtil.compare(latestEap.text, latestStable.text) > 0 -> latestEap
|
||||
else -> latestStable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLatestStableVersion() = safe {
|
||||
ConfigureDialogWithModulesAndVersion.loadVersions("1.0.0")
|
||||
@@ -73,6 +77,9 @@ private object EapVersionDownloader {
|
||||
.asReversed()
|
||||
}.asNullable.orEmpty()
|
||||
|
||||
@NonNls
|
||||
private val EAP_URL = "https://dl.bintray.com/kotlin/kotlin-eap/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/"
|
||||
|
||||
@NonNls
|
||||
private val versionRegexp = """href="([^"\\]+)"""".toRegex()
|
||||
}
|
||||
+6
-4
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemP
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.projectTemplates.ProjectTemplatesPlugin
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.IdeWizard
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.*
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep.modulesEditor.ModulesEditorComponent
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.setting.TitledComponentsList
|
||||
@@ -130,7 +131,8 @@ class BuildSystemAdditionalSettingsComponent(ideWizard: IdeWizard) : DynamicComp
|
||||
}
|
||||
|
||||
private enum class State(val sectionTitle: String) {
|
||||
POM("Artifact Coordinates"), JPS("Kotlin Runtime")
|
||||
POM(KotlinNewProjectWizardUIBundle.message("additional.buildsystem.settings.artifact.coordinates")),
|
||||
JPS(KotlinNewProjectWizardUIBundle.message("additional.buildsystem.settings.kotlin.runtime"))
|
||||
}
|
||||
|
||||
private fun BuildSystemType.state() =
|
||||
@@ -183,12 +185,12 @@ private class JdkComponent(ideWizard: IdeWizard) : TitledComponent(ideWizard.con
|
||||
}
|
||||
}
|
||||
|
||||
override val title: String = "Project JDK"
|
||||
override val title: String = KotlinNewProjectWizardUIBundle.message("additional.buildsystem.settings.project.jdk")
|
||||
override val component: JComponent = jdkComboBox
|
||||
}
|
||||
|
||||
private class KotlinRuntimeComponentComponent(ideWizard: IdeWizard) : TitledComponent(ideWizard.context) {
|
||||
override val title: String = "Kotlin Runtime"
|
||||
override val title: String = KotlinNewProjectWizardUIBundle.message("additional.buildsystem.settings.kotlin.runtime")
|
||||
override val component: JComponent = ideWizard.jpsData.libraryOptionsPanel.simplePanel
|
||||
}
|
||||
|
||||
@@ -235,7 +237,7 @@ class ProjectPreviewComponent(context: Context) : DynamicComponent(context) {
|
||||
).asSubComponent()
|
||||
|
||||
override val component: JComponent = borderPanel {
|
||||
addToTop(label("Preview", bold = true).addBorder(JBUI.Borders.emptyBottom(5)))
|
||||
addToTop(label(KotlinNewProjectWizardUIBundle.message("project.preview"), bold = true).addBorder(JBUI.Borders.emptyBottom(5)))
|
||||
addToCenter(modulesEditorComponent.component)
|
||||
}.addBorder(JBUI.Borders.empty(UIConstants.PADDING, /*left*/UIConstants.PADDING * 2, UIConstants.PADDING, UIConstants.PADDING))
|
||||
.addBorder(JBUI.Borders.customLine(JBColor.border(), 0, /*left*/1, 0, 0))
|
||||
|
||||
+5
-4
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.tools.projectWizard.core.Context
|
||||
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.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import java.awt.Dimension
|
||||
@@ -21,7 +22,7 @@ import javax.swing.JPanel
|
||||
class ModuleDependenciesComponent(
|
||||
context: Context
|
||||
) : TitledComponent(context) {
|
||||
override val title: String = "Module dependencies"
|
||||
override val title: String = KotlinNewProjectWizardUIBundle.message("module.dependencies.module.dependencies")
|
||||
private val dependenciesList = ModuleDependenciesList()
|
||||
override val forceLabelCenteringOffset: Int? = 4
|
||||
override val additionalComponentPadding: Int = 1
|
||||
@@ -35,7 +36,7 @@ class ModuleDependenciesComponent(
|
||||
dependenciesList::addDependency
|
||||
).show(button.preferredPopupPoint!!)
|
||||
}
|
||||
setAddActionName("Add module dependency")
|
||||
setAddActionName(KotlinNewProjectWizardUIBundle.message("module.dependencies.add.module.dependency"))
|
||||
setAddActionUpdater { e ->
|
||||
e.presentation.apply {
|
||||
isEnabled = possibleDependencies().isNotEmpty()
|
||||
@@ -45,7 +46,7 @@ class ModuleDependenciesComponent(
|
||||
setRemoveAction {
|
||||
dependenciesList.removeSelected()
|
||||
}
|
||||
setRemoveActionName("Remove module dependency")
|
||||
setRemoveActionName(KotlinNewProjectWizardUIBundle.message("module.dependencies.remove.module.dependency"))
|
||||
setMoveDownAction(null)
|
||||
setMoveUpAction(null)
|
||||
}
|
||||
@@ -103,7 +104,7 @@ private class AddModulesPopUp(
|
||||
|
||||
private class ModuleDependenciesList : AbstractSingleSelectableListWithIcon<Module>() {
|
||||
init {
|
||||
setEmptyText("There is no module dependencies")
|
||||
setEmptyText(KotlinNewProjectWizardUIBundle.message("module.settings.dependencies.empty"))
|
||||
}
|
||||
|
||||
override fun ColoredListCellRenderer<Module>.render(value: Module) {
|
||||
|
||||
+11
-8
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module.Comp
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.isRootModule
|
||||
import org.jetbrains.kotlin.tools.projectWizard.templates.Template
|
||||
import org.jetbrains.kotlin.tools.projectWizard.templates.settings
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.*
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.components.DropDownComponent
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.components.TextFieldComponent
|
||||
@@ -83,26 +84,28 @@ private class ModuleNameComponent(context: Context, private val module: Module)
|
||||
override val component: JComponent
|
||||
get() = textField.component
|
||||
|
||||
override val title: String = "Name"
|
||||
override val title: String = KotlinNewProjectWizardUIBundle.message("module.settings.name")
|
||||
|
||||
override fun onInit() {
|
||||
super.onInit()
|
||||
val isSingleRootMode = read { KotlinPlugin::modules.settingValue }.size == 1
|
||||
when {
|
||||
isSingleRootMode && module.isRootModule -> {
|
||||
textField.disable("[The same as the project name]")
|
||||
textField.disable(KotlinNewProjectWizardUIBundle.message("module.settings.name.same.as.project"))
|
||||
}
|
||||
module.configurator == CommonTargetConfigurator -> {
|
||||
//String concatination to not to forget localisation for localisation
|
||||
textField.disable("common" + " " + "[Can not be modified]")
|
||||
textField.disable(ModuleType.common.name + " " + KotlinNewProjectWizardUIBundle.message("module.settings.name.can.not.be.modified"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val validateModuleName =
|
||||
StringValidators.shouldNotBeBlank("Module name") and
|
||||
StringValidators.shouldBeValidIdentifier("Module Name", ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES)
|
||||
StringValidators.shouldNotBeBlank(KotlinNewProjectWizardUIBundle.message("module.settings.name.module.name")) and
|
||||
StringValidators.shouldBeValidIdentifier(
|
||||
KotlinNewProjectWizardUIBundle.message("module.settings.name.module.name"),
|
||||
ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,10 +150,10 @@ private class ModuleTemplateComponent(
|
||||
addToBottom(templateDescriptionLabel)
|
||||
}
|
||||
|
||||
override val title: String = "Template"
|
||||
override val title: String = KotlinNewProjectWizardUIBundle.message("module.settings.template")
|
||||
|
||||
private object NoneTemplate : Template() {
|
||||
override val title = "None"
|
||||
override val title = KotlinNewProjectWizardUIBundle.message("module.settings.template.none")
|
||||
override val description: String = ""
|
||||
override val moduleTypes: Set<ModuleType> = ModuleType.ALL
|
||||
override val id: String = "none"
|
||||
|
||||
+2
-2
@@ -1,6 +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.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.Component
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.PanelWithStatusText
|
||||
import java.awt.BorderLayout
|
||||
@@ -8,7 +8,7 @@ import java.awt.BorderLayout
|
||||
class NothingSelectedComponent : Component() {
|
||||
override val component = PanelWithStatusText(
|
||||
BorderLayout(),
|
||||
KotlinNewProjectWizardBundle.message("error.nothing.selected"),
|
||||
KotlinNewProjectWizardUIBundle.message("error.nothing.selected"),
|
||||
isStatusTextVisible = true
|
||||
)
|
||||
}
|
||||
+3
-1
@@ -10,6 +10,8 @@ import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.*
|
||||
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.ModuleKind
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.fullTextHtml
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.icon
|
||||
import javax.swing.Icon
|
||||
@@ -62,7 +64,7 @@ class CreateModuleOrTargetPopup private constructor(
|
||||
targetConfiguratorGroup: TargetConfiguratorGroupWithSubItems,
|
||||
showTitle: Boolean
|
||||
) : BaseListPopupStep<DisplayableSettingItem>(
|
||||
"Target".takeIf { showTitle },
|
||||
KotlinNewProjectWizardBundle.message("module.kind.target").takeIf { showTitle },
|
||||
targetConfiguratorGroup.subItems.filter { it.needToShow() }
|
||||
) {
|
||||
override fun getIconFor(value: DisplayableSettingItem): Icon? = when (value) {
|
||||
|
||||
+23
-18
@@ -12,6 +12,8 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.ModuleKind
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Sourceset
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.createPanelWithPopupHandler
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import javax.swing.JComponent
|
||||
@@ -56,11 +58,11 @@ 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.singleplatformAndroid -> " Android Module"
|
||||
text = "Add" + " " + when (tree.selectedSettingItem?.safeAs<Module>()?.kind) {
|
||||
ModuleKind.multiplatform -> KotlinNewProjectWizardBundle.message("module.kind.target")
|
||||
ModuleKind.singleplatformJvm -> KotlinNewProjectWizardBundle.message("module.kind.module")
|
||||
ModuleKind.singleplatformJs -> KotlinNewProjectWizardBundle.message("module.kind.js.module")
|
||||
ModuleKind.singleplatformAndroid -> KotlinNewProjectWizardBundle.message("module.kind.android.module")
|
||||
ModuleKind.target -> ""
|
||||
null -> ""
|
||||
}
|
||||
@@ -68,20 +70,20 @@ class ModulesEditorToolbarDecorator(
|
||||
event.presentation.isEnabled
|
||||
}
|
||||
setRemoveAction {
|
||||
val moduleKindText = selectedModuleKindText ?: "Module"
|
||||
val moduleKindText = selectedModuleKindText ?: KotlinNewProjectWizardBundle.message("module.kind.module")
|
||||
if (Messages.showOkCancelDialog(
|
||||
tree,
|
||||
buildString {
|
||||
appendln("Do you want to remove selected $moduleKindText?")
|
||||
appendln(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.module", moduleKindText))
|
||||
if (tree.selectedSettingItem.safeAs<Module>()?.kind != ModuleKind.target) {
|
||||
appendln("This will also remove all submodules.")
|
||||
appendln(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.submodules"))
|
||||
}
|
||||
appendln()
|
||||
appendln("This action cannot be undone.")
|
||||
appendln(KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.no.undone"))
|
||||
},
|
||||
"Remove selected $moduleKindText?",
|
||||
"Remove",
|
||||
"Cancel",
|
||||
KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.question", moduleKindText),
|
||||
KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.remove"),
|
||||
KotlinNewProjectWizardUIBundle.message("editor.modules.remove.selected.cancel"),
|
||||
AllIcons.General.QuestionDialog
|
||||
) == Messages.OK
|
||||
) {
|
||||
@@ -91,7 +93,10 @@ class ModulesEditorToolbarDecorator(
|
||||
setRemoveActionUpdater { event ->
|
||||
event.presentation.apply {
|
||||
isEnabled = tree.selectedSettingItem is Module
|
||||
text = "Remove" + selectedModuleKindText?.let { " $it" }.orEmpty()
|
||||
text = KotlinNewProjectWizardUIBundle.message(
|
||||
"editor.modules.remove.tooltip",
|
||||
selectedModuleKindText?.let { " $it" }.orEmpty()
|
||||
)
|
||||
}
|
||||
event.presentation.isEnabled
|
||||
}
|
||||
@@ -112,9 +117,9 @@ class ModulesEditorToolbarDecorator(
|
||||
|
||||
private val Module.kindText
|
||||
get() = when (kind) {
|
||||
ModuleKind.multiplatform -> "Module"
|
||||
ModuleKind.singleplatformJvm -> "Module"
|
||||
ModuleKind.singleplatformJs -> "Module"
|
||||
ModuleKind.singleplatformAndroid -> "Module"
|
||||
ModuleKind.target -> "Target"
|
||||
ModuleKind.multiplatform -> KotlinNewProjectWizardBundle.message("module.kind.module")
|
||||
ModuleKind.singleplatformJvm -> KotlinNewProjectWizardBundle.message("module.kind.module")
|
||||
ModuleKind.singleplatformJs -> KotlinNewProjectWizardBundle.message("module.kind.module")
|
||||
ModuleKind.singleplatformAndroid -> KotlinNewProjectWizardBundle.message("module.kind.android.module")
|
||||
ModuleKind.target -> KotlinNewProjectWizardBundle.message("module.kind.target")
|
||||
}
|
||||
+4
-3
@@ -11,6 +11,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.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.borderPanel
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.icon
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
@@ -69,9 +70,9 @@ class ModulesEditorTree(
|
||||
}
|
||||
|
||||
emptyText.clear()
|
||||
emptyText.appendText("No modules created")
|
||||
emptyText.appendText(KotlinNewProjectWizardUIBundle.message("editor.modules.no.modules"))
|
||||
emptyText.appendSecondaryText(
|
||||
"Add a module to the project",
|
||||
KotlinNewProjectWizardUIBundle.message("editor.modules.add.module"),
|
||||
SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES
|
||||
) {
|
||||
addModule(this)
|
||||
@@ -122,7 +123,7 @@ private class CellRenderer(private val context: Context, renderErrors: Boolean)
|
||||
) {
|
||||
if (value?.safeAs<DefaultMutableTreeNode>()?.userObject == ModulesEditorTree.PROJECT_USER_OBJECT) {
|
||||
icon = AllIcons.Nodes.Project
|
||||
append("Project")
|
||||
append(KotlinNewProjectWizardUIBundle.message("editor.modules.project"))
|
||||
return
|
||||
}
|
||||
val setting = (value as? DefaultMutableTreeNode)?.userObject as? DisplayableSettingItem ?: return
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep.modulesEditor
|
||||
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.TargetConfigurator
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.*
|
||||
|
||||
class NewModuleCreator {
|
||||
private fun suggestName(name: String, modules: List<Module>): String {
|
||||
private fun suggestName(@NonNls name: String, modules: List<Module>): String {
|
||||
val names = modules.map(Module::name).toSet()
|
||||
if (name !in names) return name
|
||||
var index = 1
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ import com.intellij.ui.components.JBLabel
|
||||
import com.intellij.ui.components.JBTextField
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
|
||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.ModuleConfigurator
|
||||
@@ -131,7 +132,7 @@ fun <C : JComponent> C.addBorder(border: Border): C = apply {
|
||||
this.border = BorderFactory.createCompoundBorder(border, this.border)
|
||||
}
|
||||
|
||||
fun <T> runWithProgressBar(title: String, action: () -> T): T =
|
||||
fun <T> runWithProgressBar(@Nls title: String, action: () -> T): T =
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously(
|
||||
ThrowableComputable<T, Exception> { action() },
|
||||
title,
|
||||
|
||||
@@ -7,6 +7,9 @@ dependencies {
|
||||
api("org.apache.velocity:velocity:1.7") // we have to use the old version as it is the same as bundled into IntelliJ
|
||||
compileOnly(project(":kotlin-reflect-api"))
|
||||
|
||||
//needed only for message bundles
|
||||
implementation(intellijCoreDep())
|
||||
|
||||
testImplementation(project(":kotlin-test:kotlin-test-junit"))
|
||||
testImplementation(commonDep("junit:junit"))
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${property("versions.kotlinx-collections-immutable")}")
|
||||
|
||||
Reference in New Issue
Block a user