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 {
@UiHandler("addButton")
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) {
LOG.info("Project status success");
createProject();
doCreateProject(projectName);
addDialog.hide();
} else {
LOG.info("Checking for error");
......@@ -128,35 +130,29 @@ public final class NewYoungAndroidProjectWizard {
}
public void createProject() {
String projectName = projectNameTextBox.getText().trim();
projectName = projectName.replaceAll("( )+", " ").replace(" ", "_");
if (TextValidators.checkNewProjectName(projectName)
== TextValidators.ProjectNameStatus.SUCCESS) {
String packageName = StringUtils.getProjectPackage(
Ode.getInstance().getUser().getUserEmail(), projectName);
NewYoungAndroidProjectParameters parameters = new NewYoungAndroidProjectParameters(
packageName);
NewProjectWizard.NewProjectCommand callbackCommand = new NewProjectWizard.NewProjectCommand() {
@Override
public void execute(final Project project) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
if (Ode.getInstance().screensLocked()) { // Wait until I/O finished
Scheduler.get().scheduleDeferred(this); // on other project
} else {
Ode.getInstance().openYoungAndroidProjectInDesigner(project);
}
public void doCreateProject(String projectName) {
String packageName = StringUtils.getProjectPackage(
Ode.getInstance().getUser().getUserEmail(), projectName);
NewYoungAndroidProjectParameters parameters = new NewYoungAndroidProjectParameters(
packageName);
NewProjectWizard.NewProjectCommand callbackCommand = new NewProjectWizard.NewProjectCommand() {
@Override
public void execute(final Project project) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
if (Ode.getInstance().screensLocked()) { // Wait until I/O finished
Scheduler.get().scheduleDeferred(this); // on other project
} else {
Ode.getInstance().openYoungAndroidProjectInDesigner(project);
}
});
}
};
NewProjectWizard.createNewProject(YoungAndroidProjectNode.YOUNG_ANDROID_PROJECT_TYPE, projectName,
parameters, callbackCommand);
Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.PROJECT_ACTION_NEW_YA, projectName);
}
});
}
};
}
NewProjectWizard.createNewProject(YoungAndroidProjectNode.YOUNG_ANDROID_PROJECT_TYPE, projectName,
parameters, callbackCommand);
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