Package org.eclipse.ltk.core.refactoring
Class NullChange
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.Change
-
- org.eclipse.ltk.core.refactoring.NullChange
-
- All Implemented Interfaces:
IAdaptable
public class NullChange extends Change
A refactoring change that does nothing. The reverse change of aNullChangeis aNullChange.Note: this class is not intended to be extended by clients.
- Since:
- 3.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Constructor Description NullChange()Creates a newNullChangewith a default name.NullChange(String name)Creates a newNullChangewith the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetModifiedElement()Returns the element modified by thisChange.StringgetName()Returns the human readable name of this change.voidinitializeValidationData(IProgressMonitor pm)Hook method to initialize some internal state to provide an adequate answer for theisValidmethod.RefactoringStatusisValid(IProgressMonitor pm)Verifies that this change object is still valid and can be executed by callingperform.Changeperform(IProgressMonitor pm)Performs this change.-
Methods inherited from class org.eclipse.ltk.core.refactoring.Change
dispose, getAdapter, getAffectedObjects, getDescriptor, getParent, isEnabled, setEnabled, setEnabledShallow
-
-
-
-
Constructor Detail
-
NullChange
public NullChange()
Creates a newNullChangewith a default name.
-
NullChange
public NullChange(String name)
Creates a newNullChangewith the given name.- Parameters:
name- the human readable name of this change
-
-
Method Detail
-
getName
public String getName()
Description copied from class:ChangeReturns the human readable name of this change. The name MUST not benull.
-
initializeValidationData
public void initializeValidationData(IProgressMonitor pm)
Description copied from class:ChangeHook method to initialize some internal state to provide an adequate answer for theisValidmethod. 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:
- the change hooks up a listener on some delta notification mechanism
and marks itself as invalid if it receives a certain delta. Is this
the case the implementor must take care of unhooking the listener
in
dispose. - the change remembers some information allowing to decide if a change
object is still valid when
isValidis called.
For example, a change object that manipulates the content of an
IFilecould 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 whenisValidis called.- Specified by:
initializeValidationDatain classChange- Parameters:
pm- a progress monitor
- the change hooks up a listener on some delta notification mechanism
and marks itself as invalid if it receives a certain delta. Is this
the case the implementor must take care of unhooking the listener
in
-
isValid
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException
Description copied from class:ChangeVerifies that this change object is still valid and can be executed by callingperform. If a refactoring status with a severity ofRefactoringStatus.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
UndoManagerto decide if an undo or redo change is still valid and therefore can be executed.- Specified by:
isValidin classChange- Parameters:
pm- a progress monitor.- Returns:
- a refactoring status describing the outcome of the validation check
- Throws:
CoreException- if an error occurred during validation check. The change is to be treated as invalid if an exception occurs
-
perform
public Change perform(IProgressMonitor pm) throws CoreException
Description copied from class:ChangePerforms this change. If this method is called on an invalid or disabled change object the result is unspecified. Changes should in general not respond toIProgressMonitor.isCanceled()since canceling a change tree in the middle of its execution leaves the workspace in a half changed state.- Specified by:
performin classChange- Parameters:
pm- a progress monitor- Returns:
- the undo change for this change object or
nullif no undo is provided - Throws:
CoreException- if an error occurred during change execution
-
getModifiedElement
public Object getModifiedElement()
Description copied from class:ChangeReturns the element modified by thisChange. The method may returnnullif the change isn't related to an element.- Specified by:
getModifiedElementin classChange- Returns:
- the element modified by this change
-
-