Skip to content

Commit

Permalink
Fixes #913
Browse files Browse the repository at this point in the history
  • Loading branch information
aedelmann committed May 20, 2018
1 parent 5062c2a commit 4cad7f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ protected void handleBrowse(SelectionEvent e) {
}

protected boolean validateProject() {
boolean result = true;
String projectName = getProjectName();
result &= validateStrExist(projectName,
"Project name must be specified");
result &= validateExistingSameProjectName(projectName);
result &= checkProjectName(projectName);
return result;
if (!validateStrExist(projectName,
"Project name must be specified")
|| !validateExistingSameProjectName(projectName)
|| !checkProjectName(projectName)) {
return false;
} else {
return true;
}
}

public void updateWorkspaceLocationField(String directory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public abstract class AbstractWizardPage extends WizardPage {

public static final String PROJECTNAME_REGEX = "[^a-zA-Z0-9 \\._]";
public static final String PROJECTNAME_REGEX = "[A-Z][a-zA-Z0-9_]*$";
public static final String MODEL_NAME_REGEX = "[A-Z][a-zA-Z0-9_]*$";
public static final String VERSION_REGEX = "^\\d+\\.\\d+\\.\\d+(-\\w+)*$";

Expand All @@ -45,7 +45,7 @@ protected String getWindowTitle() {
}

protected boolean checkProjectName(String projectName) {
if (checkForRegexPattern(projectName, true, PROJECTNAME_REGEX)) {
if (checkForRegexPattern(projectName, false, PROJECTNAME_REGEX)) {
setErrorMessage("Project name should not contain special characters.");
return false;
}
Expand All @@ -66,6 +66,9 @@ protected boolean validateStrExist(String string, String errorMsgToBeShown) {
}

protected boolean validateExistingSameProjectName(String projectName) {
if (projectName.length() == 0 ) {
return false;
}
IWorkspace workspace = ResourcesPlugin.getWorkspace();

if (workspace.getRoot().getProject(getProjectName()).exists()) {
Expand Down

0 comments on commit 4cad7f9

Please sign in to comment.