Wizard: do not update path & artifactId value for invalid project name
This commit is contained in:
+5
-2
@@ -78,8 +78,11 @@ class ProjectSettingsComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizar
|
|||||||
super.onValueUpdated(reference)
|
super.onValueUpdated(reference)
|
||||||
when (reference?.path) {
|
when (reference?.path) {
|
||||||
StructurePlugin::name.path -> {
|
StructurePlugin::name.path -> {
|
||||||
tryUpdateLocationByProjectName()
|
val isNameValid = read { StructurePlugin::name.reference.validate().isOk }
|
||||||
tryArtifactIdByProjectName()
|
if (isNameValid) {
|
||||||
|
tryUpdateLocationByProjectName()
|
||||||
|
tryArtifactIdByProjectName()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
StructurePlugin::artifactId.path -> {
|
StructurePlugin::artifactId.path -> {
|
||||||
artifactIdWasUpdatedByHand = true
|
artifactIdWasUpdatedByHand = true
|
||||||
|
|||||||
+3
@@ -192,6 +192,9 @@ class Context private constructor(
|
|||||||
val <V : Any, T : SettingType<V>> SettingReference<V, T>.setting: Setting<V, T>
|
val <V : Any, T : SettingType<V>> SettingReference<V, T>.setting: Setting<V, T>
|
||||||
get() = with(this) { getSetting() }
|
get() = with(this) { getSetting() }
|
||||||
|
|
||||||
|
fun <V : Any, T : SettingType<V>> SettingReference<V, T>.validate() =
|
||||||
|
setting.validator.validate(this@Reader, settingValue)
|
||||||
|
|
||||||
inline operator fun <T> invoke(reader: Reader.() -> T): T = reader()
|
inline operator fun <T> invoke(reader: Reader.() -> T): T = reader()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user