Package org.eclipse.jface.text
Interface IUndoManager
- All Known Implementing Classes:
DefaultUndoManager,TextViewerUndoManager
public interface IUndoManager
An undo manager is connected to at most one
ITextViewer.
It monitors the text viewer and keeps a history of the changes applied to the viewer. The undo manager groups those changes into user interactions which on an undo request are rolled back in one atomic change.
In order to provide backward compatibility for clients of IUndoManager, extension
interfaces are used as a means of evolution. The following extension interfaces exist:
IUndoManagerExtensionsince version 3.1 introducing access to the undo context.
Clients may implement this interface or use the standard implementation
TextViewerUndoManager.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidSignals the undo manager that all subsequent changes untilendCompoundChangeis called are to be undone in one piece.voidconnect(ITextViewer viewer) Connects this undo manager to the given text viewer.voidDisconnects this undo manager from its text viewer.voidSignals the undo manager that the sequence of changes which started withbeginCompoundChangehas been finished.voidredo()Repeats the most recently rolled back text change.booleanredoable()Returns whether at least one text change can be repeated.voidreset()Resets the history of the undo manager.voidsetMaximalUndoLevel(int undoLevel) The given parameter determines the maximal length of the history remembered by the undo manager.voidundo()Rolls back the most recently executed text change.booleanundoable()Returns whether at least one text change can be rolled back.
-
Method Details
-
connect
Connects this undo manager to the given text viewer.- Parameters:
viewer- the viewer the undo manager is connected to
-
disconnect
void disconnect()Disconnects this undo manager from its text viewer. If this undo manager hasn't been connected before this operation has no effect. -
beginCompoundChange
void beginCompoundChange()Signals the undo manager that all subsequent changes untilendCompoundChangeis called are to be undone in one piece. -
endCompoundChange
void endCompoundChange()Signals the undo manager that the sequence of changes which started withbeginCompoundChangehas been finished. All subsequent changes are considered to be individually undo-able. -
reset
void reset()Resets the history of the undo manager. After that call, there aren't any undo-able or redo-able text changes. -
setMaximalUndoLevel
void setMaximalUndoLevel(int undoLevel) The given parameter determines the maximal length of the history remembered by the undo manager.- Parameters:
undoLevel- the length of this undo manager's history
-
undoable
boolean undoable()Returns whether at least one text change can be rolled back.- Returns:
trueif at least one text change can be rolled back
-
redoable
boolean redoable()Returns whether at least one text change can be repeated. A text change can be repeated only if it was executed and rolled back.- Returns:
trueif at least on text change can be repeated
-
undo
void undo()Rolls back the most recently executed text change. -
redo
void redo()Repeats the most recently rolled back text change.
-