new TransUnitUpdatedEventHandler() {
@Override
public void onTransUnitUpdated(
final TransUnitUpdatedEvent event) {
TransUnitUpdateInfo updateInfo = event.getUpdateInfo();
TransUnitReplaceInfo replaceInfo =
allReplaceInfos.get(updateInfo.getTransUnit()
.getId());
if (replaceInfo == null) {
Log.debug("no matching TU in document for TU update, id: "
+ updateInfo.getTransUnit().getId().getId());
return;
}
Log.debug("found matching TU for TU update, id: "
+ updateInfo.getTransUnit().getId().getId());
if (replaceInfo.getReplaceState() == ReplacementState.Replaced
&& !(replaceInfo.getTransUnit().getVerNum()
.equals(updateInfo.getTransUnit()
.getVerNum()))) {
// can't undo after additional update
setReplaceState(replaceInfo,
ReplacementState.NotReplaced);
replaceInfo.setReplaceInfo(null);
replaceInfo
.setPreviewState(PreviewState.NotFetched);
replaceInfo.setPreview(null);
MultiSelectionModel<TransUnitReplaceInfo> selectionModel =
documentSelectionModels.get(updateInfo
.getDocumentId().getId());
if (selectionModel == null) {
Log.error("missing selection model for document, id: "
+ updateInfo.getDocumentId().getId());
} else {
// clear selection to avoid accidental inclusion
// in batch
// operations
selectionModel.setSelected(replaceInfo, false);
}
}
replaceInfo.setTransUnit(updateInfo.getTransUnit());
refreshInfoDisplay(replaceInfo);
}
}));
registerHandler(eventBus.addHandler(