/// <summary> /// Create an empty one to be stuck at the beginning of the task for Undo. Passed zero, one, or two /// TextStateInfo objects with the information about the endpoints. Info2 is always null if info1 is. /// </summary> public static RestoreSegmentsUndoAction CreateForUndo(FdoCache cache, TextStateInfo info1, TextStateInfo info2) { RestoreSegmentsUndoAction result = new RestoreSegmentsUndoAction(); result.m_cache = cache; result.m_fForRedo = false; if (info2 != null) result.m_textStateInfo = new TextStateInfo[] {info1, info2}; else if (info1 != null) result.m_textStateInfo = new TextStateInfo[] {info1}; else result.m_textStateInfo = new TextStateInfo[0]; return result; }
/// <summary> /// Create one for Redo, with the same information as the Undo one. /// </summary> public static RestoreSegmentsUndoAction CreateForRedo(RestoreSegmentsUndoAction undoAction) { RestoreSegmentsUndoAction result = new RestoreSegmentsUndoAction(); result.m_textStateInfo = undoAction.m_textStateInfo; result.m_cache = undoAction.m_cache; result.m_fForRedo = true; return result; }
void CommonInit() { if (m_cache.ActionHandlerAccessor == null) return; m_parseOnUndoAction = RestoreSegmentsUndoAction.CreateForUndo(m_cache, m_anchorTextInfo, m_endpointTextInfo); m_cache.ActionHandlerAccessor.AddAction(m_parseOnUndoAction); }