public class DocumentUndoManager extends Object implements IDocumentUndoManager
Based on the 3.1 implementation of DefaultUndoManager, it was implemented using the document-related manipulations defined in the original DefaultUndoManager, by separating the document manipulations from the viewer-specific processing.
The classes representing individual text edits (formerly text commands) were promoted from inner types to their own classes in order to support reassignment to a different undo manager.
This class is not intended to be subclassed.
IDocumentUndoManager,
DocumentUndoManagerRegistry,
IDocumentUndoListener,
IDocument| Constructor and Description |
|---|
DocumentUndoManager(IDocument document)
Create a DocumentUndoManager for the given document.
|
| 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.
|
public DocumentUndoManager(IDocument document)
document - the document whose undo history is being managed.public void addDocumentUndoListener(IDocumentUndoListener listener)
IDocumentUndoManagerNotifications 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.
addDocumentUndoListener in interface IDocumentUndoManagerlistener - the document undo listener to be added as a listenerpublic void removeDocumentUndoListener(IDocumentUndoListener listener)
IDocumentUndoManagerRemoving a listener which is not registered has no effect
removeDocumentUndoListener in interface IDocumentUndoManagerlistener - the document undo listener to be removedpublic IUndoContext getUndoContext()
IDocumentUndoManagergetUndoContext in interface IDocumentUndoManagerpublic void commit()
IDocumentUndoManagercommit in interface IDocumentUndoManagerpublic void reset()
IDocumentUndoManagerreset in interface IDocumentUndoManagerpublic boolean redoable()
IDocumentUndoManagerredoable in interface IDocumentUndoManagertrue if at least on text change can be repeatedpublic boolean undoable()
IDocumentUndoManagerundoable in interface IDocumentUndoManagertrue if at least one text change can be rolled backpublic void redo()
throws ExecutionException
IDocumentUndoManagerredo in interface IDocumentUndoManagerExecutionException - if an exception occurred during redopublic void undo()
throws ExecutionException
IDocumentUndoManagerundo in interface IDocumentUndoManagerExecutionException - if an exception occurred during undopublic void connect(Object client)
IDocumentUndoManagerconnect in interface IDocumentUndoManagerclient - the object connecting to the undo managerpublic void disconnect(Object client)
IDocumentUndoManagerdisconnect in interface IDocumentUndoManagerclient - the object disconnecting from the undo managerpublic void beginCompoundChange()
IDocumentUndoManagerendCompoundChange is called are to be undone in one piece.beginCompoundChange in interface IDocumentUndoManagerpublic void endCompoundChange()
IDocumentUndoManagerbeginCompoundChange has been finished. All subsequent
changes are considered to be individually undo-able.endCompoundChange in interface IDocumentUndoManagerpublic void setMaximalUndoLevel(int undoLimit)
IDocumentUndoManagersetMaximalUndoLevel in interface IDocumentUndoManagerundoLimit - the length of this undo manager's historypublic void transferUndoHistory(IDocumentUndoManager manager)
IDocumentUndoManagertransferUndoHistory in interface IDocumentUndoManagermanager - the document undo manger whose history is to be transferred to the receiverGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.