Class MoveResourceChange
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.Change
-
- org.eclipse.ltk.core.refactoring.resource.ResourceChange
-
- org.eclipse.ltk.core.refactoring.resource.MoveResourceChange
-
- All Implemented Interfaces:
IAdaptable
public class MoveResourceChange extends ResourceChange
Changethat moves a resource.- Since:
- 3.4
-
-
Field Summary
-
Fields inherited from class org.eclipse.ltk.core.refactoring.resource.ResourceChange
SAVE_IF_DIRTY, VALIDATE_DEFAULT, VALIDATE_NOT_DIRTY, VALIDATE_NOT_READ_ONLY
-
-
Constructor Summary
Constructors Modifier Constructor Description MoveResourceChange(IResource source, IContainer target)Creates the change.protectedMoveResourceChange(IResource source, IContainer target, long stampToRestore, Change restoreSourceChange)Creates the change.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangeDescriptorgetDescriptor()Returns a descriptor of this change.protected IResourcegetModifiedResource()Returns the resource of this change.StringgetName()Returns the human readable name of this change.Changeperform(IProgressMonitor monitor)Performs this change.voidsetDescriptor(ChangeDescriptor descriptor)Sets the change descriptor to be returned byChange.getDescriptor().-
Methods inherited from class org.eclipse.ltk.core.refactoring.resource.ResourceChange
checkIfModifiable, getModifiedElement, initializeValidationData, isValid, setValidationMethod, toString
-
Methods inherited from class org.eclipse.ltk.core.refactoring.Change
dispose, getAdapter, getAffectedObjects, getParent, isEnabled, setEnabled, setEnabledShallow
-
-
-
-
Constructor Detail
-
MoveResourceChange
public MoveResourceChange(IResource source, IContainer target)
Creates the change.- Parameters:
source- the resource to movetarget- the container the resource is moved to. An existing resource at the destination will be replaced.
-
MoveResourceChange
protected MoveResourceChange(IResource source, IContainer target, long stampToRestore, Change restoreSourceChange)
Creates the change.- Parameters:
source- the resource to movetarget- the container the resource is moved to. An existing resource at the destination will be replaced.stampToRestore- the stamp to restore on the moved resourcerestoreSourceChange- the change to restore a resource at the source ornullif no resource needs to be resourced.
-
-
Method Detail
-
getDescriptor
public ChangeDescriptor getDescriptor()
Description copied from class:ChangeReturns a descriptor of this change.Subclasses of changes created by
Refactoring.createChange(IProgressMonitor)should override this method to return aRefactoringChangeDescriptor. A change tree created by a particular refactoring is supposed to contain at most one change which returns a refactoring descriptor. Refactorings usually return an instance ofCompositeChangein theirRefactoring.createChange(IProgressMonitor)method which implements this method. The refactoring framework searches the change tree top-down until a refactoring descriptor is found.- Overrides:
getDescriptorin classChange- Returns:
- a descriptor of this change, or
nullif this change does not provide a change descriptor.
-
setDescriptor
public void setDescriptor(ChangeDescriptor descriptor)
Sets the change descriptor to be returned byChange.getDescriptor().- Parameters:
descriptor- the change descriptor
-
perform
public final Change perform(IProgressMonitor monitor) throws CoreException, OperationCanceledException
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:
monitor- 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 executionOperationCanceledException
-
getModifiedResource
protected IResource getModifiedResource()
Description copied from class:ResourceChangeReturns the resource of this change.- Specified by:
getModifiedResourcein classResourceChange- Returns:
- the resource of this change
-
-