public class TextViewerUndoManager extends Object implements IUndoManager, IUndoManagerExtension
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.
ITextViewer
,
ITextInputListener
,
IDocumentUndoManager
,
MouseListener
,
KeyListener
,
DocumentUndoManager
Constructor and Description |
---|
TextViewerUndoManager(int undoLevel)
Creates a new undo manager who remembers the specified number of edit commands.
|
Modifier and Type | Method and Description |
---|---|
void |
beginCompoundChange()
Signals the undo manager that all subsequent changes until
endCompoundChange is called are to be undone in one piece. |
void |
connect(ITextViewer textViewer)
Connects this undo manager to the given text viewer.
|
void |
disconnect()
Disconnects this undo manager from its text viewer.
|
void |
endCompoundChange()
Signals the undo manager that the sequence of changes which started with
beginCompoundChange has been finished. |
IUndoContext |
getUndoContext()
Returns this undo manager's undo context.
|
void |
redo()
Repeats the most recently rolled back text change.
|
boolean |
redoable()
Returns whether at least one text change can be repeated.
|
void |
reset()
Resets the history of the undo manager.
|
void |
setMaximalUndoLevel(int undoLevel)
The given parameter determines the maximal length of the history
remembered by the undo manager.
|
void |
undo()
Rolls back the most recently executed text change.
|
boolean |
undoable()
Returns whether at least one text change can be rolled back.
|
public TextViewerUndoManager(int undoLevel)
undoLevel
- the length of this manager's historypublic void beginCompoundChange()
IUndoManager
endCompoundChange
is called are to be undone in one piece.beginCompoundChange
in interface IUndoManager
public void endCompoundChange()
IUndoManager
beginCompoundChange
has been finished. All subsequent changes
are considered to be individually undo-able.endCompoundChange
in interface IUndoManager
public void setMaximalUndoLevel(int undoLevel)
IUndoManager
setMaximalUndoLevel
in interface IUndoManager
undoLevel
- the length of this undo manager's historypublic void connect(ITextViewer textViewer)
IUndoManager
connect
in interface IUndoManager
textViewer
- the viewer the undo manager is connected topublic void disconnect()
IUndoManager
disconnect
in interface IUndoManager
public void reset()
IUndoManager
reset
in interface IUndoManager
public boolean redoable()
IUndoManager
redoable
in interface IUndoManager
true
if at least on text change can be repeatedpublic boolean undoable()
IUndoManager
undoable
in interface IUndoManager
true
if at least one text change can be rolled backpublic void redo()
IUndoManager
redo
in interface IUndoManager
public void undo()
IUndoManager
undo
in interface IUndoManager
public IUndoContext getUndoContext()
IUndoManagerExtension
getUndoContext
in interface IUndoManagerExtension
null
if the undo manager is not connectedIUndoContext
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.