IUndoContext oldUndoContext= manager.getUndoContext();
// Get the history for the old undo context.
IUndoableOperation [] operations= OperationHistoryFactory.getOperationHistory().getUndoHistory(oldUndoContext);
for (int i= 0; i < operations.length; i++) {
// First replace the undo context
IUndoableOperation op= operations[i];
if (op instanceof IContextReplacingOperation) {
((IContextReplacingOperation)op).replaceContext(oldUndoContext, getUndoContext());
} else {
op.addContext(getUndoContext());
op.removeContext(oldUndoContext);
}
// Now update the manager that owns the text edit.
if (op instanceof UndoableTextChange) {
((UndoableTextChange)op).fDocumentUndoManager= this;
}
}
IUndoableOperation op= OperationHistoryFactory.getOperationHistory().getUndoOperation(getUndoContext());
if (op != null && !(op instanceof UndoableTextChange))
return;
// Record the transfer itself as an undoable change.
// If the transfer results from some open operation, recording this change will