public interface IDocumentUndoManager
Clients must explicitly connect to the undo manager to express their interest in the undo history. Clients should disconnect from the undo manager when they are no longer interested in tracking the undo history. If there are no clients connected to the undo manager, it will not track the document's changes and will dispose of any history that was previously kept.
Clients may also listen to the undo manager for notifications before and after undo or redo events are performed. Clients must connect to the undo manager in addition to registering listeners.
Clients may implement this interface.
DocumentUndoManagerRegistry
,
IDocumentUndoListener
,
IDocument
Modifier and Type | Method and Description |
---|---|
void |
addDocumentUndoListener(IDocumentUndoListener listener)
Adds the specified listener to the list of document undo listeners that
are notified before and after changes are undone or redone in the
document.
|
void |
beginCompoundChange()
Signals the undo manager that all subsequent changes until
endCompoundChange is called are to be undone in one piece. |
void |
commit()
Closes the currently open text edit and open a new one.
|
void |
connect(Object client)
Connects to the undo manager.
|
void |
disconnect(Object client)
Disconnects from the undo manager.
|
void |
endCompoundChange()
Signals the undo manager that the sequence of changes which started with
beginCompoundChange has been finished. |
IUndoContext |
getUndoContext()
Returns the undo context registered for this document
|
void |
redo()
Repeats the most recently rolled back text change.
|
boolean |
redoable()
Returns whether at least one text change can be repeated.
|
void |
removeDocumentUndoListener(IDocumentUndoListener listener)
Removes the specified listener from the list of document undo listeners.
|
void |
reset()
Resets the history of the undo manager.
|
void |
setMaximalUndoLevel(int undoLimit)
Sets the limit of the undo history to the specified value.
|
void |
transferUndoHistory(IDocumentUndoManager manager)
Transfers the undo history from the specified document undo manager to
this 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.
|
void addDocumentUndoListener(IDocumentUndoListener listener)
Notifications will not be received if there are no clients connected to the receiver. Registering a document undo listener does not implicitly connect the listener to the receiver.
Document undo listeners must be prepared to receive notifications from a background thread. Any UI access occurring inside the implementation must be properly synchronized using the techniques specified by the client's widget library.
listener
- the document undo listener to be added as a listenervoid removeDocumentUndoListener(IDocumentUndoListener listener)
Removing a listener which is not registered has no effect
listener
- the document undo listener to be removedIUndoContext getUndoContext()
void commit()
void connect(Object client)
client
- the object connecting to the undo managervoid disconnect(Object client)
client
- the object disconnecting from the undo managervoid beginCompoundChange()
endCompoundChange
is called are to be undone in one piece.void endCompoundChange()
beginCompoundChange
has been finished. All subsequent
changes are considered to be individually undo-able.void setMaximalUndoLevel(int undoLimit)
undoLimit
- the length of this undo manager's historyvoid reset()
boolean undoable()
true
if at least one text change can be rolled backboolean redoable()
true
if at least on text change can be repeatedvoid undo() throws ExecutionException
ExecutionException
- if an exception occurred during undovoid redo() throws ExecutionException
ExecutionException
- if an exception occurred during redovoid transferUndoHistory(IDocumentUndoManager manager)
manager
- the document undo manger whose history is to be transferred to the receiver
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.