org.eclipse.jface.text
Class TextViewerUndoManager
java.lang.Object
org.eclipse.jface.text.TextViewerUndoManager
-
All Implemented Interfaces:
-
IUndoManager,
IUndoManagerExtension
-
public class TextViewerUndoManager
- extends
Object
- implements
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:
-
ITextViewer
,
ITextInputListener
,
IDocumentUndoManager
,
MouseListener
,
KeyListener
,
DocumentUndoManager
-
Restriction:
- This class is not intended to be subclassed by clients.
Constructor Summary
|
TextViewerUndoManager
(int undoLevel)
Creates a new undo manager who remembers the specified number of edit commands. |
Method Summary
|
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. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
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
beginCompoundChange
public void beginCompoundChange()
-
Description copied from interface:
IUndoManager
- Signals the undo manager that all subsequent changes until
endCompoundChange
is called are to be undone in one piece.
-
-
Specified by:
-
beginCompoundChange
in interface
IUndoManager
-
endCompoundChange
public void endCompoundChange()
-
Description copied from interface:
IUndoManager
- Signals the undo manager that the sequence of changes which started with
beginCompoundChange
has been finished. All subsequent changes
are considered to be individually undo-able.
-
-
Specified by:
-
endCompoundChange
in interface
IUndoManager
-
setMaximalUndoLevel
public void setMaximalUndoLevel(int undoLevel)
-
Description copied from interface:
IUndoManager
- The given parameter determines the maximal length of the history
remembered by the undo manager.
-
-
Specified by:
-
setMaximalUndoLevel
in interface
IUndoManager
-
-
Parameters:
-
undoLevel
- the length of this undo manager's history
connect
public void connect(
ITextViewer textViewer)
-
Description copied from interface:
IUndoManager
- Connects this undo manager to the given text viewer.
-
-
Specified by:
-
connect
in interface
IUndoManager
-
-
Parameters:
-
textViewer
- the viewer the undo manager is connected to
disconnect
public void disconnect()
-
Description copied from interface:
IUndoManager
- Disconnects this undo manager from its text viewer.
If this undo manager hasn't been connected before this
operation has no effect.
-
-
Specified by:
-
disconnect
in interface
IUndoManager
-
reset
public void reset()
-
Description copied from interface:
IUndoManager
- Resets the history of the undo manager. After that call,
there aren't any undo-able or redo-able text changes.
-
-
Specified by:
-
reset
in interface
IUndoManager
-
redoable
public boolean redoable()
-
Description copied from interface:
IUndoManager
- Returns 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:
-
redoable
in interface
IUndoManager
-
-
Returns:
-
true
if at least on text change can be repeated
undoable
public boolean undoable()
-
Description copied from interface:
IUndoManager
- Returns whether at least one text change can be rolled back.
-
-
Specified by:
-
undoable
in interface
IUndoManager
-
-
Returns:
-
true
if at least one text change can be rolled back
redo
public void redo()
-
Description copied from interface:
IUndoManager
- Repeats the most recently rolled back text change.
-
-
Specified by:
-
redo
in interface
IUndoManager
-
undo
public void undo()
-
Description copied from interface:
IUndoManager
- Rolls back the most recently executed text change.
-
-
Specified by:
-
undo
in interface
IUndoManager
-
getUndoContext
public
IUndoContext getUndoContext()
-
Description copied from interface:
IUndoManagerExtension
- Returns this undo manager's undo context.
-
-
Specified by:
-
getUndoContext
in interface
IUndoManagerExtension
-
-
Returns:
- the undo context or
null
if the undo manager is not connected -
See Also:
-
IUndoContext
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.