* @see org.eclipse.jdt.ui.wizards.NewTypeWizardPage#typeNameChanged()
*/
protected IStatus typeNameChanged() {
super.typeNameChanged();
JUnitStatus status = new JUnitStatus();
String typeName = getTypeName();
// must not be empty
if (typeName.length() == 0) {
status.setError(WizardMessages.NewTestSuiteWizPage_typeName_error_name_empty);
return status;
}
if (typeName.indexOf('.') != -1) {
status.setError(WizardMessages.NewTestSuiteWizPage_typeName_error_name_qualified);
return status;
}
IStatus val = JavaConventionsUtil.validateJavaTypeName(typeName,
getJavaProject());
if (val.getSeverity() == IStatus.ERROR) {
status.setError(WizardMessages.NewTestSuiteWizPage_typeName_error_name_not_valid
+ val.getMessage());
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(WizardMessages.NewTestSuiteWizPage_typeName_error_name_name_discouraged
+ val.getMessage());
// continue checking
}
IStatus recursiveSuiteInclusionStatus = checkRecursiveTestSuiteInclusion();
if (!recursiveSuiteInclusionStatus.isOK())
return recursiveSuiteInclusionStatus;
IPackageFragment pack = getPackageFragment();
if (pack != null) {
ICompilationUnit cu = pack.getCompilationUnit(typeName + ".java"); //$NON-NLS-1$
if (cu.exists()) {
status.setWarning(WizardMessages.NewTestSuiteWizPage_typeName_warning_already_exists);
return status;
}
}
return status;
}