|
Eclipse JDT Release 3.0 |
||||||||||
| 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.UndoTextFileChange
A change to perform the reverse change of a TextFileChange.
This class is not intended to be instantiated by clients. It is
usually created by a TextFileChange object.
The class should be subclassed by clients also subclassing
TextFileChange to provide a proper undo change object.
| Constructor Summary | |
protected |
UndoTextFileChange(String name,
org.eclipse.core.resources.IFile file,
org.eclipse.text.edits.UndoEdit undo,
ContentStamp stamp,
int saveMode)
Create a new undo text file change object. |
| Method Summary | |
protected Change |
createUndoChange(org.eclipse.text.edits.UndoEdit edit,
ContentStamp stampToRestore)
Hook to create an undo change for the given undo edit. |
void |
dispose()
Disposes this change. Subclasses that override this method typically unregister listeners which got registered during the call to
initializeValidationState.
Subclasses may override this method. |
Object |
getModifiedElement()
Returns the element modified by this Change. The method may return
null if the change isn't related to an element. |
String |
getName()
Returns the human readable name of this change. The name MUST not be null. |
int |
getSaveMode()
Returns the change's save mode. |
void |
initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm)
Hook method to initialize some internal state to provide an adequate answer for the 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:
For example, a change object that manipulates the content of an |
RefactoringStatus |
isValid(org.eclipse.core.runtime.IProgressMonitor pm)
Verifies that this change object is still valid and can be executed by calling perform. If a refactoring status with a severity of RefactoringStatus.FATAL is 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 |
Change |
perform(org.eclipse.core.runtime.IProgressMonitor pm)
Performs this change. If this method is call on an invalid or disabled change object the result is unspecified. Changes should in general not respond to IProgressMonitor.isCanceled() since canceling a change tree in the
middle of its execution leaves the workspace in a half changed state. |
| Methods inherited from class org.eclipse.ltk.core.refactoring.Change |
getAdapter, getParent, isEnabled, setEnabled |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected UndoTextFileChange(String name,
org.eclipse.core.resources.IFile file,
org.eclipse.text.edits.UndoEdit undo,
ContentStamp stamp,
int saveMode)
name - the human readable name of the changefile - the file the change is working onstamp - the content stamp to restore when the undo is executedundo - the edit representing the undo modificationssaveMode - the save mode as specified by TextFileChangeTextFileChange.KEEP_SAVE_STATE,
TextFileChange.FORCE_SAVE,
TextFileChange.LEAVE_DIRTY| Method Detail |
public int getSaveMode()
TextFileChange.KEEP_SAVE_STATE,
TextFileChange.FORCE_SAVE,
TextFileChange.LEAVE_DIRTYpublic String getName()
null.
getName in class Change
protected Change createUndoChange(org.eclipse.text.edits.UndoEdit edit,
ContentStamp stampToRestore)
throws org.eclipse.core.runtime.CoreException
Subclasses may override it to create a different undo change.
edit - the undo edit to create a undo change forstampToRestore - the content stamp to restore when the undo
edit is executed.
org.eclipse.core.runtime.CoreException - if an undo change can't be createdpublic Object getModifiedElement()
Change. The method may return
null if the change isn't related to an element.
getModifiedElement in class Changepublic void initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm)
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 Changepm - a progress monitor
public RefactoringStatus isValid(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
perform. If a refactoring status with a severity of RefactoringStatus.FATAL is 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.
isValid in class Changepm - a progress monitor.
org.eclipse.core.runtime.CoreException - if an error occurred during validation check. The change
is to be treated as invalid if an exception occurs
public Change perform(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
IProgressMonitor.isCanceled() since canceling a change tree in the
middle of its execution leaves the workspace in a half changed state.
perform in class Changepm - a progress monitor
null if no
undo is provided
org.eclipse.core.runtime.CoreException - if an error occurred during change executionpublic void dispose()
initializeValidationState.
Subclasses may override this method.
dispose in class Change
|
Eclipse JDT Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||