Package org.eclipse.ltk.core.refactoring
Interface IUndoManager
-
public interface IUndoManagerAn undo manager keeps track of performed changes. Use the methodaddUndoto add change objects to the undo stack andperformUndoandperformRedoto undo or redo changes.This interface is not intended to be implemented by clients. Clients should use the method
RefactoringCore.getUndoManager()to access the refactoring undo manager.As of 3.1 the implementation of the refactoring undo manager is based on the
IOperationHistoryprovided by theorg.eclipse.core.commandsplug-in.As of 3.2 clients which need to examine refactorings which have been performed, undone or redone should use
IRefactoringHistoryServicefor enhanced functionality.- Since:
- 3.0
- See Also:
IOperationHistory- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaboutToPerformChange(Change change)The infrastructure is going to perform the given change.voidaddListener(IUndoManagerListener listener)Adds a listener to the undo manager.voidaddUndo(String name, Change change)Adds a new undo change to this undo manager.booleananythingToRedo()Returnstrueif there is anything to redo, otherwisefalse.booleananythingToUndo()Returnstrueif there is anything to undo, otherwisefalse.voidchangePerformed(Change change)Deprecated.use #changePerformed(Change, boolean) insteadvoidchangePerformed(Change change, boolean successful)The infrastructure has performed the given change.voidflush()Flushes the undo manager's undo and redo stacks.StringpeekRedoName()Returns the name of the top most redo.StringpeekUndoName()Returns the name of the top most undo.voidperformRedo(IValidationCheckResultQuery query, IProgressMonitor pm)Redo the top most redo change.voidperformUndo(IValidationCheckResultQuery query, IProgressMonitor pm)Undo the top most undo change.voidremoveListener(IUndoManagerListener listener)Removes the given listener from this undo manager.voidshutdown()Shut down the undo manager.
-
-
-
Method Detail
-
addListener
void addListener(IUndoManagerListener listener)
Adds a listener to the undo manager. Does nothing if the listener is already present.- Parameters:
listener- the listener to be added to the undo manager
-
removeListener
void removeListener(IUndoManagerListener listener)
Removes the given listener from this undo manager. Does nothing if the listener isn't registered with this undo manager- Parameters:
listener- the listener to be removed
-
aboutToPerformChange
void aboutToPerformChange(Change change)
The infrastructure is going to perform the given change. If a client calls this method it must make sure that the corresponding methodchangePerformed(Change)is called after the change got executed. A typically code snippet looks as follows:Change change= ...; try { undoManager.aboutToPerformChange(change); // execute change } finally { undoManager.changePerformed(change); }- Parameters:
change- the change to be performed.
-
changePerformed
@Deprecated void changePerformed(Change change)
Deprecated.use #changePerformed(Change, boolean) insteadThe infrastructure has performed the given change.- Parameters:
change- the change that was performed
-
changePerformed
void changePerformed(Change change, boolean successful)
The infrastructure has performed the given change.- Parameters:
change- the change that was performedsuccessful-trueif the change got executed successful;falseotherwise.- Since:
- 3.1
-
addUndo
void addUndo(String name, Change change)
Adds a new undo change to this undo manager.- Parameters:
name- the name presented on the undo stack for the provided undo change. The name must be human readable.change- the undo change
-
anythingToUndo
boolean anythingToUndo()
Returnstrueif there is anything to undo, otherwisefalse.- Returns:
trueif there is anything to undo, otherwisefalse
-
peekUndoName
String peekUndoName()
Returns the name of the top most undo.- Returns:
- the top most undo name. Returns
nullif there aren't any changes to undo.
-
performUndo
void performUndo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException
Undo the top most undo change.- Parameters:
query- a proceed query to decide how to proceed if the validation checking of the undo change to perform returns a non OK status and the status isn't a fatal error. Ifnullis passed in the undo proceeds if the status is not a fatal error.pm- a progress monitor to report progress during performing the undo change- Throws:
CoreException- if performing the undo caused an exception
-
anythingToRedo
boolean anythingToRedo()
Returnstrueif there is anything to redo, otherwisefalse.- Returns:
trueif there is anything to redo, otherwisefalse
-
peekRedoName
String peekRedoName()
Returns the name of the top most redo.- Returns:
- the top most redo name. Returns
nullif there are no any changes to redo.
-
performRedo
void performRedo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException
Redo the top most redo change.- Parameters:
query- a proceed query to decide how to proceed if the validation checking of the redo change to perform returns a non OK status. Ifnullis passed in the undo proceeds if the status is not a fatal error.pm- a progress monitor to report progress during performing the redo change- Throws:
CoreException- if performing the redo caused an exception
-
flush
void flush()
Flushes the undo manager's undo and redo stacks.
-
shutdown
void shutdown()
Shut down the undo manager.
-
-