SourceUndoManager Class
- public class SourceUndoManager
extends UndoManager
The SourceUndoManager manages the undo/redo stacks and dirty state for a source document.
-
Hierarchy
-
Object
AbstractUndoableEdit
CompoundEdit
UndoManager
SourceUndoManager
-
All Implemented Interfaces
-
EventListener
, Serializable
, UndoableEdit
, UndoableEditListener
Methods from javax.swing.undo.UndoManager |
canRedo, canUndo, canUndoOrRedo, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoableEditHappened, undoOrRedo, undoTo |
Methods from javax.swing.undo.CompoundEdit |
addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, isSignificant, lastEdit, redo, toString, undo |
Methods from javax.swing.undo.AbstractUndoableEdit |
addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, redo, replaceEdit, toString, undo |
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods from interface javax.swing.undo.UndoableEdit |
addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, redo, replaceEdit, undo |
SourceUndoManager
public SourceUndoManager(ISourceDocument
file)
- Creates a new SourceUndoManager for the specified document
addEdit(UndoableEdit) Method
public boolean addEdit(UndoableEdit
e)
-
Overrides
-
UndoManager.addEdit(UndoableEdit)
discardAllEdits() Method
public void discardAllEdits()
Clear all edits in the undo queue. These undos are then lost, and so the edits
may not be undone.
-
Overrides
-
UndoManager.discardAllEdits()
getMark() Method
public Object
getMark()
Returns a mark object that can be used in conjunction with SourceUndoManager.undoToMark(Object)
Returns
- An object identifying the current location in the undo stack.
redo() Method
public void redo()
Performs a redo, updating document dirty state if needed.
-
Overrides
-
UndoManager.redo()
registerSourceView(ISourceView) Method
public void registerSourceView(ISourceView
sv)
Registers a source view with this undo manager. All registered source views will have their caret position
updated automatically as a result of undo and redo actions.
Parameters
-
sv
- The source view.
setIgnoreEdits(boolean) Method
public void setIgnoreEdits(boolean ignoreEdits)
Sets a flag indicating that edits should be ignored by the undo manager. Great care must be taken when calling this
method because the IDE will crash if the document state and the undo stack are in an unsynchronized state when
the user attempts to undo or redo. It is the caller's responsiblity to ensure that the document and undo
stack stay in sync for the entire time that the manager is ignoring edits.
Parameters
-
ignoreEdits
- whether edits should be ignored
setUncleanable() Method
public void setUncleanable()
Sets a flag indicating that this document cannot reach a clean state until the file is saved to disk.
undo() Method
public void undo()
Performs an undo, updating document dirty state if needed.
-
Overrides
-
UndoManager.undo()
undoToMark(Object) Method
public boolean undoToMark(Object
mark)
Used in conjunction with SourceUndoManager.getMark()
. Undoes edits until a particular edit is on the top of the undo
stack. If the undo isn't found, all undos will be executed, exhausting the stack.
Parameters
-
mark
- The last edit that should remain on the stack
Returns
- boolean indicating whether the mark was found
unregisterSourceView(ISourceView) Method
public void unregisterSourceView(ISourceView
sv)
Unegisters a source view from this undo manager. While the undo manager will continue to function normally,
unregistered source views will not have their caret positions updated as a result of undo/redo actions.
Parameters
-
sv
- The source view.