Package org.eclipse.jface.text
Class TextViewerUndoManager
java.lang.Object
org.eclipse.jface.text.TextViewerUndoManager
- All Implemented Interfaces:
IUndoManager,IUndoManagerExtension
Implementation of
IUndoManager using the shared
document undo manager.
It registers with the connected text viewer as text input listener, and obtains its undo manager from the current document. It also monitors mouse and keyboard activities in order to partition the stream of text changes into undo-able edit commands.
This class is not intended to be subclassed.
- Since:
- 3.2
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Constructor Summary
ConstructorsConstructorDescriptionTextViewerUndoManager(int undoLevel) Creates a new undo manager who remembers the specified number of edit commands. -
Method Summary
Modifier and TypeMethodDescriptionvoidSignals the undo manager that all subsequent changes untilendCompoundChangeis called are to be undone in one piece.voidconnect(ITextViewer textViewer) 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.Returns this undo manager's undo context.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.
-
Constructor Details
-
TextViewerUndoManager
public TextViewerUndoManager(int undoLevel) Creates a new undo manager who remembers the specified number of edit commands.- Parameters:
undoLevel- the length of this manager's history
-
-
Method Details
-
beginCompoundChange
public void beginCompoundChange()Description copied from interface:IUndoManagerSignals the undo manager that all subsequent changes untilendCompoundChangeis called are to be undone in one piece.- Specified by:
beginCompoundChangein interfaceIUndoManager
-
endCompoundChange
public void endCompoundChange()Description copied from interface:IUndoManagerSignals the undo manager that the sequence of changes which started withbeginCompoundChangehas been finished. All subsequent changes are considered to be individually undo-able.- Specified by:
endCompoundChangein interfaceIUndoManager
-
setMaximalUndoLevel
public void setMaximalUndoLevel(int undoLevel) Description copied from interface:IUndoManagerThe given parameter determines the maximal length of the history remembered by the undo manager.- Specified by:
setMaximalUndoLevelin interfaceIUndoManager- Parameters:
undoLevel- the length of this undo manager's history
-
connect
Description copied from interface:IUndoManagerConnects this undo manager to the given text viewer.- Specified by:
connectin interfaceIUndoManager- Parameters:
textViewer- the viewer the undo manager is connected to
-
disconnect
public void disconnect()Description copied from interface:IUndoManagerDisconnects this undo manager from its text viewer. If this undo manager hasn't been connected before this operation has no effect.- Specified by:
disconnectin interfaceIUndoManager
-
reset
public void reset()Description copied from interface:IUndoManagerResets the history of the undo manager. After that call, there aren't any undo-able or redo-able text changes.- Specified by:
resetin interfaceIUndoManager
-
redoable
public boolean redoable()Description copied from interface:IUndoManagerReturns whether at least one text change can be repeated. A text change can be repeated only if it was executed and rolled back.- Specified by:
redoablein interfaceIUndoManager- Returns:
trueif at least on text change can be repeated
-
undoable
public boolean undoable()Description copied from interface:IUndoManagerReturns whether at least one text change can be rolled back.- Specified by:
undoablein interfaceIUndoManager- Returns:
trueif at least one text change can be rolled back
-
redo
public void redo()Description copied from interface:IUndoManagerRepeats the most recently rolled back text change.- Specified by:
redoin interfaceIUndoManager
-
undo
public void undo()Description copied from interface:IUndoManagerRolls back the most recently executed text change.- Specified by:
undoin interfaceIUndoManager
-
getUndoContext
Description copied from interface:IUndoManagerExtensionReturns this undo manager's undo context.- Specified by:
getUndoContextin interfaceIUndoManagerExtension- Returns:
- the undo context or
nullif the undo manager is not connected - See Also:
-