@Override
public void onRenamed(Item item, String oldName, String newName) {
super.onRenamed(item, oldName, newName);
ScmSyncConfigurationPlugin plugin = ScmSyncConfigurationPlugin.getInstance();
if(plugin != null){
ScmSyncStrategy strategy = plugin.getStrategyForSaveable(item, null);
if(strategy != null){
File parentDir = item.getRootDir().getParentFile();
File oldDir = new File( parentDir.getAbsolutePath()+File.separator+oldName );
File newDir = new File( parentDir.getAbsolutePath()+File.separator+newName );
String oldPath = JenkinsFilesHelper.buildPathRelativeToHudsonRoot(oldDir);
String newPath = JenkinsFilesHelper.buildPathRelativeToHudsonRoot(newDir);
WeightedMessage message = strategy.getCommitMessageFactory().getMessageWhenItemRenamed(item, oldPath, newPath);
plugin.getTransaction().defineCommitMessage(message);
plugin.getTransaction().registerRenamedPath(oldPath, newPath);
}
}
}