Libraries.Interface.Undo.EditManager Documentation

EditManager controls an undo/redo style system. We can use it by adding edits to the manager and then calling the appropriate undo or redo messages. Besides this, EditManager can empty itself of all edits, return items, and broadly allow the user to visit the items in the lists.

Example Code

use Libraries.Interface.Undo.EditManager
    use Libraries.Interface.Undo.Edit

    EditManager edits
    Edit edit
    edits:Add(edit)
    edits:Undo()

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(Libraries.Interface.Undo.Edit undo)The Add(Edit) action adds an item to the undo list.
CanRedo()This action checks to see if there is any items that can be redone.
CanUndo()This action checks to see if there is any items that can be undone.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Empty()This action empties the EditManager of all edits.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetHashCode()This action gets the hash code for an object.
GetRedoCount()This action returns how many edits there are in the redo list.
GetUndoCount()This action returns how many edits there are in the undo list.
Redo()The Redo action redoes an Edit that was added to the system.
Undo()The Undo action undoes an Edit that was added to the system.

Actions Documentation

Add(Libraries.Interface.Undo.Edit undo)

The Add(Edit) action adds an item to the undo list. The redo list cannot be directly added to and is, instead, controlled by undoing.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        edits:Undo()

Parameters

CanRedo()

This action checks to see if there is any items that can be redone. If so, it returns true.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        output edits:CanRedo()

Return

boolean: whether we can redo

CanUndo()

This action checks to see if there is any items that can be undone. If so, it returns true.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        output edits:CanUndo()

Return

boolean: whether we can undo

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Empty()

This action empties the EditManager of all edits. In the process, it calls dispose on each edit to ensure it has the opportunity to free any resources.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        edits:Empty()

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetRedoCount()

This action returns how many edits there are in the redo list.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        output edits:GetRedoCount()

Return

integer: how many edits are in the redo list

GetUndoCount()

This action returns how many edits there are in the undo list.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        output edits:GetUndoCount()

Return

integer: how many edits are in the undo list

Redo()

The Redo action redoes an Edit that was added to the system. If there is nothing to redo, then this action is ignored.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        edits:Undo()
        edits:Redo()

Undo()

The Undo action undoes an Edit that was added to the system. If there is nothing to undo, this call is ignored.

Example Code

use Libraries.Interface.Undo.EditManager
        use Libraries.Interface.Undo.Edit

        EditManager edits
        Edit edit
        edits:Add(edit)
        edits:Undo()