public class UndoTextFileChange extends Change
This class is not intended to be instantiated by clients. It is
usually created by a
The class should be subclassed by clients also subclassing
TextFileChange to provide a proper undo change object.
|Modifier||Constructor and Description|
Create a new undo text file change object.
|Modifier and Type||Method and Description|
Hook to create an undo change for the given undo edit.
Disposes this change.
Returns the elements affected by this change or
Returns the element modified by this
Returns the human readable name of this change.
Returns the change's save mode.
Hook method to initialize some internal state to provide an adequate answer for the
Verifies that this change object is still valid and can be executed by calling
Performs this change.
getAdapter, getDescriptor, getParent, isEnabled, setEnabled, setEnabledShallow
protected UndoTextFileChange(String name, IFile file, UndoEdit undo, ContentStamp stamp, int saveMode)
name- the human readable name of the change
file- the file the change is working on
stamp- the content stamp to restore when the undo is executed
undo- the edit representing the undo modifications
saveMode- the save mode as specified by
public int getSaveMode()
public String getName()
protected Change createUndoChange(UndoEdit edit, ContentStamp stampToRestore) throws CoreException
Subclasses may override it to create a different undo change.
public Object getModifiedElement()
Change. The method may return
nullif the change isn't related to an element.
public Object getAffectedObjects()
nullif the affected elements cannot be determined. Returns an empty array if the change doesn't modify any elements.
This default implementation returns
null to indicate that
the affected elements are unknown. Subclasses should reimplement this method
if they can compute the set of affected elements.
public void initializeValidationData(IProgressMonitor pm)
isValidmethod. This method gets called after a change or a whole change tree has been created.
Typically this method is implemented in one of the following ways:
For example, a change object that manipulates the content of an
could either listen to resource changes and detect that the file got changed or
it could remember some content stamp and compare it with the actual content stamp
isValid is called.
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException
perform. If a refactoring status with a severity of
RefactoringStatus.FATALis returned then the change has to be treated as invalid and can no longer be executed. Performing such a change produces an unspecified result and will very likely throw an exception.
This method is also called by the
UndoManager to decide if
an undo or redo change is still valid and therefore can be executed.
public Change perform(IProgressMonitor pm) throws CoreException
IProgressMonitor.isCanceled()since canceling a change tree in the middle of its execution leaves the workspace in a half changed state.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.