Eclipse Platform
2.0

org.eclipse.jface.text
Interface IUndoManager

All Known Implementing Classes:
DefaultUndoManager

public interface IUndoManager

An undo manager is connected to at most one text viewer. It monitors the text viewer and keeps a history of the changes applied to the viewer. The undo manager groups those changes into user interactions which on an undo request are rolled back in one atomic change.

Clients may implement this interface or use the standard implementation DefaultUndoManager.


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 viewer)
          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.
 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.
 

Method Detail

connect

public void connect(ITextViewer viewer)
Connects this undo manager to the given text viewer.

Parameters:
viewer - the viewer the undo manager is connected to

disconnect

public void disconnect()
Disconnects this undo manager from its text viewer. If this undo manager hasn't been connected before this operation has no effect.


beginCompoundChange

public void beginCompoundChange()
Signals the undo manager that all subsequent changes until endCompoundChange is called are to be undone in one piece.


endCompoundChange

public void endCompoundChange()
Signals the undo manager that the sequence of changes which started with beginCompoundChange has been finished. All subsequent changes are considered to be individually undoable.


reset

public void reset()
Resets the history of the undo manager. After that call, there aren't any undoable or redoable text changes.


setMaximalUndoLevel

public void setMaximalUndoLevel(int undoLevel)
The given parameter determines the maximal length of the history remembered by the undo manager.

Parameters:
undoLevel - the length of this undo manager's history

undoable

public boolean undoable()
Returns whether at least one text change can be rolled back.

Returns:
true if at least one text change can be rolled back

redoable

public boolean redoable()
Returns whether at least one text change can be repeated. A text change can be repeated only if it was executed and rolled back.

Returns:
true if at least on text change can be repeated

undo

public void undo()
Rolls back the most recently executed text change.


redo

public void redo()
Repeats the most recently rolled back text change.


Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.