Unverified Commit ab109ff4 authored by Susan Rati Lane's avatar Susan Rati Lane Committed by GitHub

Restore substitution for spaces in project name (#2991)

parent 7cde9da3
...@@ -104,10 +104,12 @@ public final class NewYoungAndroidProjectWizard { ...@@ -104,10 +104,12 @@ public final class NewYoungAndroidProjectWizard {
@UiHandler("addButton") @UiHandler("addButton")
void addProject(ClickEvent e) { void addProject(ClickEvent e) {
TextValidators.ProjectNameStatus status = TextValidators.checkNewProjectName(projectNameTextBox.getText()); String projectName = projectNameTextBox.getText().trim();
projectName = projectName.replaceAll("( )+", " ").replace(" ", "_");
TextValidators.ProjectNameStatus status = TextValidators.checkNewProjectName(projectName);
if (status == TextValidators.ProjectNameStatus.SUCCESS) { if (status == TextValidators.ProjectNameStatus.SUCCESS) {
LOG.info("Project status success"); LOG.info("Project status success");
createProject(); doCreateProject(projectName);
addDialog.hide(); addDialog.hide();
} else { } else {
LOG.info("Checking for error"); LOG.info("Checking for error");
...@@ -128,11 +130,7 @@ public final class NewYoungAndroidProjectWizard { ...@@ -128,11 +130,7 @@ public final class NewYoungAndroidProjectWizard {
} }
public void createProject() { public void doCreateProject(String projectName) {
String projectName = projectNameTextBox.getText().trim();
projectName = projectName.replaceAll("( )+", " ").replace(" ", "_");
if (TextValidators.checkNewProjectName(projectName)
== TextValidators.ProjectNameStatus.SUCCESS) {
String packageName = StringUtils.getProjectPackage( String packageName = StringUtils.getProjectPackage(
Ode.getInstance().getUser().getUserEmail(), projectName); Ode.getInstance().getUser().getUserEmail(), projectName);
NewYoungAndroidProjectParameters parameters = new NewYoungAndroidProjectParameters( NewYoungAndroidProjectParameters parameters = new NewYoungAndroidProjectParameters(
...@@ -156,7 +154,5 @@ public final class NewYoungAndroidProjectWizard { ...@@ -156,7 +154,5 @@ public final class NewYoungAndroidProjectWizard {
NewProjectWizard.createNewProject(YoungAndroidProjectNode.YOUNG_ANDROID_PROJECT_TYPE, projectName, NewProjectWizard.createNewProject(YoungAndroidProjectNode.YOUNG_ANDROID_PROJECT_TYPE, projectName,
parameters, callbackCommand); parameters, callbackCommand);
Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_ACTION_NEW_YA, projectName); Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_ACTION_NEW_YA, projectName);
}
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment