public Change createChange(IProgressMonitor pm) throws CoreException,
OperationCanceledException {
try {
pm.beginTask("Creating change...", 1);
CompositeChange compositeChange = new CompositeChange("Rename Spring " + type.getType() + " id") {
@Override
public ChangeDescriptor getDescriptor() {
String project = file.getProject().getName();
String description = MessageFormat.format("Rename Spring " + type.getType() + " ''{0}''",
new Object[] { oldBeanId });
String comment = MessageFormat.format(
"Rename Spring " + type.getType() + " from ''{0}'' to ''{1}''", new Object[] { oldBeanId,
beanId });
Map<String, String> arguments = new HashMap<String, String>();
arguments.put(OLDNAME, oldBeanId);
arguments.put(NAME, beanId);
arguments.put(ID_TYPE, type.toString());
arguments.put(FILE, file.getFullPath().toString());
arguments.put(REFERENCES, Boolean.valueOf(updateReferences).toString());
arguments.put(OFFSET, Integer.toString(offset));
RenameIdRefactoringDescriptor idRefactoringDescriptor = new RenameIdRefactoringDescriptor(project, description, comment,
arguments);
return new RefactoringChangeDescriptor(idRefactoringDescriptor);
}
};
Change change = BeansRefactoringChangeUtils.createRenameBeanIdChange(file, type, oldBeanId,
beanId, updateReferences, pm);
if (change != null) {
compositeChange.add(change);
}
if (updateReferences) {
addChangesForUpdatedReferences(type, compositeChange, pm);
}
return compositeChange;