if (offset1 != -1 && oldName1 != null
&& oldName1.substring(1).equals(oldName)) {
MovedTextFileChange change1 = new MovedTextFileChange(
"Rename artifactId's value", newFile,
deploymentPlanFile);
MultiTextEdit rootEdit1 = new MultiTextEdit();
ReplaceEdit edit1 = new ReplaceEdit(offset1, oldName1
.length(), "/" + newName);
rootEdit1.addChild(edit1);
change1.setEdit(rootEdit1);
result.add(change1);
}
}
// create change for artifactId
String oldName2 = editHelper
.getNodeValue(DeploymentPlanTextNode.ARTIFACT_ID);
int offset2 = editHelper
.getNodeOffset(DeploymentPlanTextNode.ARTIFACT_ID);
if (offset2 != -1 && oldName2 != null && oldName2.equals(oldName)) {
MovedTextFileChange change2 = new MovedTextFileChange(
"Rename context-root's value", newFile,
deploymentPlanFile);
MultiTextEdit rootEdit2 = new MultiTextEdit();
ReplaceEdit edit2 = new ReplaceEdit(offset2, oldName2.length(),
newName);
rootEdit2.addChild(edit2);
change2.setEdit(rootEdit2);
result.add(change2);
}
} finally {