result.addError("Type " + fNewName + " already exists in package " + getType().getPackageFragment().getElementName());
result.addError("Type named " + fNewName + " already exists in package " + getType().getPackageFragment().getElementName());
	public RefactoringStatus checkInput(IProgressMonitor pm) throws JavaModelException{		Assert.isNotNull(getType(), "type");		Assert.isNotNull(fNewName, "newName");		RefactoringStatus result= new RefactoringStatus();		try{			pm.beginTask("", 73);			pm.subTask("checking preconditions");			result.merge(checkNewName());			if (result.hasFatalError())				return result;						pm.worked(2);			result.merge(checkTypesInCompilationUnit());			pm.worked(1);			result.merge(checkImportedTypes());				pm.worked(1);			if (mustRenameCU())				result.merge(Checks.checkCompilationUnitNewName(getType().getCompilationUnit(), fNewName));			pm.worked(1);				if (isEnclosedInType(getType(), fNewName))					result.addError("Type " + getType().getFullyQualifiedName() + " is enclosed in a type named " + fNewName);			pm.worked(1);				if (enclosesType(getType(), fNewName))				result.addError("Type " + getType().getFullyQualifiedName() + " encloses a type named " + fNewName);			pm.worked(1);				if (typeNameExistsInPackage(getType().getPackageFragment(), fNewName))				result.addError("Type " + fNewName + " already exists in package " + getType().getPackageFragment().getElementName());			pm.worked(1);				if (compilationUnitImportsType(getType().getCompilationUnit(), fNewName))					result.addError("Type " + fNewName + " is imported (single-type-import) in " + getResource(getType()).getFullPath() + " (a compilation unit must not import and declare a type with the same name)");			pm.worked(1);				result.merge(Checks.checkForNativeMethods(getType()));			pm.worked(1);				result.merge(Checks.checkForMainMethod(getType()));			pm.worked(1);							// before doing any expensive analysis			if (result.hasFatalError())				return result;							result.merge(analyseEnclosedLocalTypes(getType(), fNewName));			pm.worked(1);			// before doing _the really_ expensive analysis			if (result.hasFatalError())				return result;												//if (Flags.isPublic(getType().getFlags()))			//	result.merge(analyzeImportDeclarations(new SubProgressMonitor(pm, 8)));							pm.worked(1);			result.merge(Checks.checkAffectedResourcesAvailability(getOccurrences(new SubProgressMonitor(pm, 35))));			result.merge(analyzeAffectedCompilationUnits(new SubProgressMonitor(pm, 25)));		} finally {			pm.done();		}			return result;	}