diff --git a/libraries/tools/new-project-wizard/resources/messages/KotlinNewProjectWizardBundle.properties b/libraries/tools/new-project-wizard/resources/messages/KotlinNewProjectWizardBundle.properties index 688966647f0..cf2380c8caa 100644 --- a/libraries/tools/new-project-wizard/resources/messages/KotlinNewProjectWizardBundle.properties +++ b/libraries/tools/new-project-wizard/resources/messages/KotlinNewProjectWizardBundle.properties @@ -49,7 +49,7 @@ plugin.android.setting.sdk=Android SDK validation.should.not.be.blank={0} should not be blank validation.identifier={0} should consist only of letters, digits{1} -validation.identifier.additional.symbols=", and symbols: {0} +validation.identifier.additional.symbols=, and symbols: {0} validation.file.should.exists=File for {0} should exists version.error.bad.format=Bad version format for setting {0} diff --git a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/entity/settings/SettingType.kt b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/entity/settings/SettingType.kt index d6fb2a8fa97..ff73ae92ea0 100644 --- a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/entity/settings/SettingType.kt +++ b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/core/entity/settings/SettingType.kt @@ -30,7 +30,7 @@ object StringSettingType : SettingType() { class Builder( path: String, - private val title: String, + val title: String, neededAtPhase: GenerationPhase ) : SettingBuilder(path, title, neededAtPhase) { fun shouldNotBeBlank() { diff --git a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/StructurePlugin.kt b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/StructurePlugin.kt index 7f354944456..bf448b6f82e 100644 --- a/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/StructurePlugin.kt +++ b/libraries/tools/new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/plugins/StructurePlugin.kt @@ -33,21 +33,21 @@ class StructurePlugin(context: Context) : Plugin(context) { ) { isSavable = true shouldNotBeBlank() - validate(StringValidators.shouldBeValidIdentifier(title, setOf('.', '_'))) + validate(StringValidators.shouldBeValidIdentifier(title, ALLOWED_SPECIAL_CHARS_IN_GROUP_ID)) } val artifactId by stringSetting( KotlinNewProjectWizardBundle.message("plugin.structure.setting.artifact.id"), GenerationPhase.FIRST_STEP ) { shouldNotBeBlank() - validate(StringValidators.shouldBeValidIdentifier(title, setOf('_'))) + validate(StringValidators.shouldBeValidIdentifier(title, ALLOWED_SPECIAL_CHARS_IN_ARTIFACT_ID)) } val version by stringSetting( KotlinNewProjectWizardBundle.message("plugin.structure.setting.version"), GenerationPhase.FIRST_STEP ) { shouldNotBeBlank() - validate(StringValidators.shouldBeValidIdentifier(title, setOf('_', '-', '.'))) + validate(StringValidators.shouldBeValidIdentifier(title, ALLOWED_SPECIAL_CHARS_IN_VERSION)) defaultValue = value("1.0-SNAPSHOT") } @@ -56,6 +56,12 @@ class StructurePlugin(context: Context) : Plugin(context) { service().createDirectory(StructurePlugin::projectPath.reference.settingValue) } } + + companion object { + private val ALLOWED_SPECIAL_CHARS_IN_GROUP_ID = Module.ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES + '.' + private val ALLOWED_SPECIAL_CHARS_IN_ARTIFACT_ID = Module.ALLOWED_SPECIAL_CHARS_IN_MODULE_NAMES + private val ALLOWED_SPECIAL_CHARS_IN_VERSION = setOf('_', '-', '.') + } } val Reader.projectPath