setErrorMessage("Classes cannot have the same name");
return false;
}
i = 0;
}
LocationValidator v = new LocationValidator(null);
for (Text field : allText) {
String textField = field.getText();
if (Utils.isEmpty(textField)) {
setErrorMessage("Name cannot be empty");
return false;
}
if (textField.length() > 40) {
setErrorMessage("Name length cannot exceed 40");
return false;
}
if (!Utils.isAlphaNumericValid(textField)) {
setErrorMessage("Name must be alphanumeric");
return false;
}
if (Utils.startsWithNumeric(textField)) {
setErrorMessage("Name must not start with number");
return false;
}
String fileName = textField + ".cls";
String metaName = textField + ".cls-meta.xml";
IStatus status = v.validateName(fileName, 0); //type didn't seem to matter, so just used 0
if (status.getCode() != IStatus.OK) {
setErrorMessage("Creating a file name of " + fileName + " is invalid because: " + status.getMessage());
return false;
}
status = v.validateName(metaName, 0); //type didn't seem to matter, so just used 0
if (status.getCode() != IStatus.OK) {
setErrorMessage("Creating a file name of" + metaName + "is invalid because: " + status.getMessage());
return false;
}
}