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

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.

Parameters

Example

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

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

CanRedo()

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

Return

boolean: whether we can redo

Example

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

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

CanUndo()

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

Return

boolean: whether we can undo

Example

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

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

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.

Parameters

Return

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

Example

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

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

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.

Parameters

Return

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

Example

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

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetRedoCount()

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

Return

integer: how many edits are in the redo list

Example

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

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

GetUndoCount()

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

Return

integer: how many edits are in the undo list

Example

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

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

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

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

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

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