|
Eclipse Platform Release 3.4 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ltk.core.refactoring.Change
org.eclipse.ltk.core.refactoring.resource.ResourceChange
Abstract change for resource based changes. The change controls the resource time stamp and read only state of the resource and makes sure it is not changed before executing the change.
Field Summary | |
static int |
SAVE_IF_DIRTY
The 'save if dirty' validation method performs the default validations (see VALIDATE_DEFAULT ) and will
save all unsaved modifications to the resource. |
static int |
VALIDATE_DEFAULT
The default validation method. |
static int |
VALIDATE_NOT_DIRTY
The 'not dirty' validation method performs the default validations (see VALIDATE_DEFAULT ) and additionally ensures that the element
does not contain unsaved modifications. |
static int |
VALIDATE_NOT_READ_ONLY
The 'not read only' validation method performs the default validations (see VALIDATE_DEFAULT ) and additionally ensures that the element
is not read only. |
Constructor Summary | |
ResourceChange()
Creates the resource change. |
Method Summary | |
protected static void |
checkIfModifiable(RefactoringStatus result,
IResource resource,
int validationMethod)
Utility method to validate a resource to be modified. |
Object |
getModifiedElement()
Returns the element modified by this Change . |
protected abstract IResource |
getModifiedResource()
Returns the resource of this change. |
void |
initializeValidationData(IProgressMonitor pm)
Hook method to initialize some internal state to provide an adequate answer for the isValid method. |
RefactoringStatus |
isValid(IProgressMonitor pm)
This implementation of Change.isValid(IProgressMonitor) tests the modified resource using the validation method
specified by setValidationMethod(int) . |
void |
setValidationMethod(int validationMethod)
Sets the validation methods used when the current resource is validated in isValid(IProgressMonitor) .
|
String |
toString()
|
Methods inherited from class org.eclipse.ltk.core.refactoring.Change |
dispose, getAdapter, getAffectedObjects, getDescriptor, getName, getParent, isEnabled, perform, setEnabled, setEnabledShallow |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int VALIDATE_DEFAULT
public static final int VALIDATE_NOT_READ_ONLY
VALIDATE_DEFAULT
) and additionally ensures that the element
is not read only.
public static final int VALIDATE_NOT_DIRTY
VALIDATE_DEFAULT
) and additionally ensures that the element
does not contain unsaved modifications.
public static final int SAVE_IF_DIRTY
VALIDATE_DEFAULT
) and will
save all unsaved modifications to the resource.
Constructor Detail |
public ResourceChange()
Method Detail |
protected abstract IResource getModifiedResource()
public void initializeValidationData(IProgressMonitor pm)
Change
isValid
method. 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:
dispose
.isValid
is called.
For example, a change object that manipulates the content of an IFile
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
when isValid
is called.
initializeValidationData
in class Change
pm
- a progress monitorpublic void setValidationMethod(int validationMethod)
isValid(IProgressMonitor)
.
By default the validation method is VALIDATE_DEFAULT
. Change implementors can add VALIDATE_NOT_DIRTY
,
VALIDATE_NOT_READ_ONLY
or SAVE_IF_DIRTY
.
validationMethod
- the validation method used in isValid(IProgressMonitor)
.
Supported validation methods currently are:
or combinations of these variables.public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException
Change.isValid(IProgressMonitor)
tests the modified resource using the validation method
specified by setValidationMethod(int)
.
isValid
in class Change
pm
- a progress monitor.
OperationCanceledException
- if the validation check got canceled
CoreException
- if an error occurred during validation check. The change
is to be treated as invalid if an exception occursprotected static void checkIfModifiable(RefactoringStatus result, IResource resource, int validationMethod)
result
- the status where the result will be added toresource
- the resource to validatevalidationMethod
- the validation method used in isValid(IProgressMonitor)
.
Supported validation methods currently are:
or combinations of these methods.public Object getModifiedElement()
Change
Change
. The method may return
null
if the change isn't related to an element.
getModifiedElement
in class Change
public String toString()
|
Eclipse Platform Release 3.4 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.