|
Eclipse Platform Release 3.3 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.text.undo.DocumentUndoManager
A standard implementation of a document-based undo manager that creates an undo history based on changes to its document.
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 Summary | |
---|---|
DocumentUndoManager(IDocument document)
Create a DocumentUndoManager for the given document. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DocumentUndoManager(IDocument document)
document
- the document whose undo history is being managed.Method Detail |
public void addDocumentUndoListener(IDocumentUndoListener listener)
IDocumentUndoManager
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.
addDocumentUndoListener
in interface IDocumentUndoManager
listener
- the document undo listener to be added as a listenerpublic void removeDocumentUndoListener(IDocumentUndoListener listener)
IDocumentUndoManager
Removing a listener which is not registered has no effect
removeDocumentUndoListener
in interface IDocumentUndoManager
listener
- the document undo listener to be removedpublic IUndoContext getUndoContext()
IDocumentUndoManager
getUndoContext
in interface IDocumentUndoManager
public void commit()
IDocumentUndoManager
commit
in interface IDocumentUndoManager
public void reset()
IDocumentUndoManager
reset
in interface IDocumentUndoManager
public boolean redoable()
IDocumentUndoManager
redoable
in interface IDocumentUndoManager
true
if at least on text change can be repeatedpublic boolean undoable()
IDocumentUndoManager
undoable
in interface IDocumentUndoManager
true
if at least one text change can be rolled backpublic void redo() throws ExecutionException
IDocumentUndoManager
redo
in interface IDocumentUndoManager
ExecutionException
- if an exception occurred during redopublic void undo() throws ExecutionException
IDocumentUndoManager
undo
in interface IDocumentUndoManager
ExecutionException
- if an exception occurred during undopublic void connect(Object client)
IDocumentUndoManager
connect
in interface IDocumentUndoManager
client
- the object connecting to the undo managerpublic void disconnect(Object client)
IDocumentUndoManager
disconnect
in interface IDocumentUndoManager
client
- the object disconnecting from the undo managerpublic void beginCompoundChange()
IDocumentUndoManager
endCompoundChange
is called are to be undone in one piece.
beginCompoundChange
in interface IDocumentUndoManager
public void endCompoundChange()
IDocumentUndoManager
beginCompoundChange
has been finished. All subsequent
changes are considered to be individually undo-able.
endCompoundChange
in interface IDocumentUndoManager
public void setMaximalUndoLevel(int undoLimit)
IDocumentUndoManager
setMaximalUndoLevel
in interface IDocumentUndoManager
undoLimit
- the length of this undo manager's historypublic void transferUndoHistory(IDocumentUndoManager manager)
IDocumentUndoManager
transferUndoHistory
in interface IDocumentUndoManager
manager
- the document undo manger whose history is to be transferred to the receiver
|
Eclipse Platform Release 3.3 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.