// update main type name
IType[] types = cu.getTypes();
for (int i = 0, max = types.length; i < max; i++) {
IType currentType = types[i];
if (currentType.getElementName().equals(oldTypeName)) {
AbstractTypeDeclaration typeNode = (AbstractTypeDeclaration) ((JavaElement) currentType).findNode(astCU);
if (typeNode != null) {
// rename type
rewriter.replace(typeNode.getName(), ast.newSimpleName(newTypeName), null);
// rename constructors
Iterator bodyDeclarations = typeNode.bodyDeclarations().iterator();
while (bodyDeclarations.hasNext()) {
Object bodyDeclaration = bodyDeclarations.next();
if (bodyDeclaration instanceof MethodDeclaration) {
MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
if (methodDeclaration.isConstructor()) {