|
|||||||||
| 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.TextEditBasedChange
org.eclipse.xtext.ui.refactoring.impl.DisplayChangeWrapper
public class DisplayChangeWrapper
Wraps a Change to be performed on the display thread.
DocumentChanges are by default not executed on the display
thread, causing thread access exceptions and leaving documents opened in editors in an inconsistent state.
| Constructor Summary | |
|---|---|
|
DisplayChangeWrapper(org.eclipse.ltk.core.refactoring.Change delegate)
|
protected |
DisplayChangeWrapper(org.eclipse.ltk.core.refactoring.Change delegate,
org.eclipse.ui.texteditor.ITextEditor editorToSave)
Deprecated. Saving editors cause unpredictable errors in combination with resource rename changes |
|
DisplayChangeWrapper(org.eclipse.ltk.core.refactoring.TextEditBasedChange delegate,
org.eclipse.ui.texteditor.ITextEditor editorToSave)
Deprecated. Saving editors cause unpredictable errors in combination with resource rename changes |
| Method Summary | |
|---|---|
void |
addChangeGroup(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup group)
Adds a text edit change group. |
void |
addTextEditGroup(org.eclipse.text.edits.TextEditGroup group)
Adds a text edit group. |
void |
dispose()
Disposes this change. |
boolean |
equals(java.lang.Object obj)
|
java.lang.Object |
getAdapter(java.lang.Class adapter)
Returns an object which is an instance of the given class associated with this object. |
java.lang.Object[] |
getAffectedObjects()
Returns the elements affected by this change or null if
the affected elements cannot be determined. |
java.lang.String |
getCurrentContent(org.eclipse.core.runtime.IProgressMonitor pm)
Returns the current content of the document this text change is associated with. |
java.lang.String |
getCurrentContent(org.eclipse.jface.text.IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
org.eclipse.core.runtime.IProgressMonitor pm)
Returns the current content of the text edit change clipped to a specific region. |
org.eclipse.ltk.core.refactoring.Change |
getDelegate()
|
org.eclipse.ltk.core.refactoring.ChangeDescriptor |
getDescriptor()
Returns a descriptor of this change. |
boolean |
getKeepPreviewEdits()
Returns whether preview edits are remembered for further region tracking or not. |
java.lang.Object |
getModifiedElement()
Returns the element modified by this Change. |
java.lang.String |
getName()
Returns the human readable name of this change. |
org.eclipse.ltk.core.refactoring.Change |
getParent()
Returns the parent change. |
java.lang.String |
getPreviewContent(org.eclipse.core.runtime.IProgressMonitor pm)
Returns the preview content as a string. |
java.lang.String |
getPreviewContent(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup[] changeGroups,
org.eclipse.jface.text.IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
org.eclipse.core.runtime.IProgressMonitor pm)
Returns a preview of the text edit change clipped to a specific region. |
protected org.eclipse.ltk.core.refactoring.TextEditBasedChange |
getTextEditBasedChangeDelegate()
|
java.lang.String |
getTextType()
Returns the text edit change's text type. |
int |
hashCode()
|
boolean |
hasOneGroupCategory(java.util.List groupCategories)
Returns true if the change has one of the given group
categories. |
void |
initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm)
Hook method to initialize some internal state to provide an adequate answer for the isValid method. |
boolean |
isEnabled()
Returns whether this change is enabled or not. |
org.eclipse.ltk.core.refactoring.RefactoringStatus |
isValid(org.eclipse.core.runtime.IProgressMonitor pm)
Verifies that this change object is still valid and can be executed by calling perform. |
org.eclipse.ltk.core.refactoring.Change |
perform(org.eclipse.core.runtime.IProgressMonitor pm)
Performs this change. |
void |
setEnabled(boolean enabled)
Sets whether this change is enabled or not. |
void |
setKeepPreviewEdits(boolean keep)
Controls whether the text edit change should keep executed edits during preview generation. |
void |
setTextType(java.lang.String type)
Sets the text type. |
java.lang.String |
toString()
|
| Methods inherited from class org.eclipse.ltk.core.refactoring.TextEditBasedChange |
|---|
getChangeGroups |
| Methods inherited from class org.eclipse.ltk.core.refactoring.Change |
|---|
setEnabledShallow |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated
public DisplayChangeWrapper(org.eclipse.ltk.core.refactoring.TextEditBasedChange delegate,
org.eclipse.ui.texteditor.ITextEditor editorToSave)
public DisplayChangeWrapper(org.eclipse.ltk.core.refactoring.Change delegate)
@Deprecated
protected DisplayChangeWrapper(org.eclipse.ltk.core.refactoring.Change delegate,
org.eclipse.ui.texteditor.ITextEditor editorToSave)
| Method Detail |
|---|
public org.eclipse.ltk.core.refactoring.Change getDelegate()
public org.eclipse.ltk.core.refactoring.ChangeDescriptor getDescriptor()
org.eclipse.ltk.core.refactoring.Change
Subclasses of changes created by
Refactoring.createChange(IProgressMonitor) should override this
method to return a RefactoringChangeDescriptor. 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 of CompositeChange in their
Refactoring.createChange(IProgressMonitor) method which
implements this method. The refactoring framework searches the change
tree top-down until a refactoring descriptor is found.
getDescriptor in class org.eclipse.ltk.core.refactoring.Changenull if this
change does not provide a change descriptor.public java.lang.String getName()
org.eclipse.ltk.core.refactoring.TextEditBasedChangenull.
getName in class org.eclipse.ltk.core.refactoring.TextEditBasedChangepublic void setEnabled(boolean enabled)
org.eclipse.ltk.core.refactoring.TextEditBasedChange
setEnabled in class org.eclipse.ltk.core.refactoring.TextEditBasedChangeenabled - true to enable this change;
false otherwisepublic org.eclipse.ltk.core.refactoring.Change getParent()
org.eclipse.ltk.core.refactoring.Changenull if no
parent exists.
getParent in class org.eclipse.ltk.core.refactoring.Changepublic void dispose()
org.eclipse.ltk.core.refactoring.Change
initializeValidationData.
Subclasses may override this method.
dispose in class org.eclipse.ltk.core.refactoring.Changepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.Object getModifiedElement()
org.eclipse.ltk.core.refactoring.ChangeChange. The method may return
null if the change isn't related to an element.
getModifiedElement in class org.eclipse.ltk.core.refactoring.Changepublic java.lang.Object[] getAffectedObjects()
org.eclipse.ltk.core.refactoring.Changenull if
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.
getAffectedObjects in class org.eclipse.ltk.core.refactoring.Changenull if
the affected elements cannot be determinedpublic java.lang.Object getAdapter(java.lang.Class adapter)
org.eclipse.ltk.core.refactoring.Changenull if
no such object can be found.
getAdapter in interface org.eclipse.core.runtime.IAdaptablegetAdapter in class org.eclipse.ltk.core.refactoring.Changeadapter - the adapter class to look up
null if this object does not
have an adapter for the given classpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isEnabled()
org.eclipse.ltk.core.refactoring.Change
isEnabled in class org.eclipse.ltk.core.refactoring.Changetrue if the change is enabled; false
otherwise.public void initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm)
org.eclipse.ltk.core.refactoring.ChangeisValid 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 org.eclipse.ltk.core.refactoring.Changepm - a progress monitor
public org.eclipse.ltk.core.refactoring.RefactoringStatus isValid(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException,
org.eclipse.core.runtime.OperationCanceledException
org.eclipse.ltk.core.refactoring.Changeperform. 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 org.eclipse.ltk.core.refactoring.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
org.eclipse.core.runtime.OperationCanceledException - if the validation check got canceled
public org.eclipse.ltk.core.refactoring.Change perform(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
org.eclipse.ltk.core.refactoring.ChangeIProgressMonitor.isCanceled() since canceling a change tree in the
middle of its execution leaves the workspace in a half changed state.
perform in class org.eclipse.ltk.core.refactoring.Changepm - a progress monitor
null if no
undo is provided
org.eclipse.core.runtime.CoreException - if an error occurred during change executionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void addChangeGroup(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup group)
org.eclipse.ltk.core.refactoring.TextEditBasedChangetext edit change group.
The edits managed by the given text edit change group must be part of
the change's root edit.
addChangeGroup in class org.eclipse.ltk.core.refactoring.TextEditBasedChangegroup - the text edit change group to addpublic void addTextEditGroup(org.eclipse.text.edits.TextEditGroup group)
org.eclipse.ltk.core.refactoring.TextEditBasedChangetext edit group. This method is a convenience
method for calling change.addChangeGroup(new
TextEditBasedChangeGroup(change, group));.
addTextEditGroup in class org.eclipse.ltk.core.refactoring.TextEditBasedChangegroup - the text edit group to addpublic boolean hasOneGroupCategory(java.util.List groupCategories)
org.eclipse.ltk.core.refactoring.TextEditBasedChangetrue if the change has one of the given group
categories. Otherwise false is returned.
hasOneGroupCategory in class org.eclipse.ltk.core.refactoring.TextEditBasedChangegroupCategories - the group categories to check
public java.lang.String getCurrentContent(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
org.eclipse.ltk.core.refactoring.TextEditBasedChange
getCurrentContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangepm - a progress monitor to report progress or null
if no progress reporting is desired
org.eclipse.core.runtime.CoreException - if the content can't be accessed
public java.lang.String getCurrentContent(org.eclipse.jface.text.IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
org.eclipse.ltk.core.refactoring.TextEditBasedChangeexpandRegionToFullLine is false
then the parameter region determines the clipping.
expandRegionToFullLine is true
then the region determined by the parameter region
is extended to cover full lines.
surroundingLines > 0 then the given number
of surrounding lines is added. The value of surroundingLines
is only considered if expandRegionToFullLine
is true
getCurrentContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangeregion - the starting region for the text to be returnedexpandRegionToFullLine - if true is passed the region
is extended to cover full linessurroundingLines - the number of surrounding lines to be added to
the clipping region. Is only considered if expandRegionToFullLine
is truepm - a progress monitor to report progress or null
if no progress reporting is desired
org.eclipse.core.runtime.CoreException - if an exception occurs while accessing the current contentpublic boolean getKeepPreviewEdits()
org.eclipse.ltk.core.refactoring.TextEditBasedChange
getKeepPreviewEdits in class org.eclipse.ltk.core.refactoring.TextEditBasedChangetrue if executed text edits are remembered
during preview generation; otherwise false
public java.lang.String getPreviewContent(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup[] changeGroups,
org.eclipse.jface.text.IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
org.eclipse.ltk.core.refactoring.TextEditBasedChangetext edit change groups.
The region is determined as follows:
expandRegionToFullLine is false
then the parameter region determines the clipping.
expandRegionToFullLine is true
then the region determined by the parameter region
is extended to cover full lines.
surroundingLines > 0 then the given number
of surrounding lines is added. The value of surroundingLines
is only considered if expandRegionToFullLine
is true
getPreviewContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangechangeGroups - a set of change groups for which a preview is to be
generatedregion - the starting region for the clippingexpandRegionToFullLine - if true is passed the region
is extended to cover full linessurroundingLines - the number of surrounding lines to be added to
the clipping region. Is only considered if expandRegionToFullLine
is truepm - a progress monitor to report progress or null
if no progress reporting is desired
org.eclipse.core.runtime.CoreException - if an exception occurs while generating the previewTextEditBasedChange.getCurrentContent(IRegion, boolean, int, IProgressMonitor)
public java.lang.String getPreviewContent(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
org.eclipse.ltk.core.refactoring.TextEditBasedChange
getPreviewContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangepm - a progress monitor to report progress or null
if no progress reporting is desired
org.eclipse.core.runtime.CoreException - if the preview can't be createdpublic java.lang.String getTextType()
org.eclipse.ltk.core.refactoring.TextEditBasedChange
getTextType in class org.eclipse.ltk.core.refactoring.TextEditBasedChangepublic void setKeepPreviewEdits(boolean keep)
org.eclipse.ltk.core.refactoring.TextEditBasedChange
setKeepPreviewEdits in class org.eclipse.ltk.core.refactoring.TextEditBasedChangekeep - if true executed preview edits are keptpublic void setTextType(java.lang.String type)
org.eclipse.ltk.core.refactoring.TextEditBasedChangeorg.eclipse.compare.contentMergeViewers.
The default text type is txt.
setTextType in class org.eclipse.ltk.core.refactoring.TextEditBasedChangetype - the text type. If null is passed the text type is
reseted to the default text type txt.protected org.eclipse.ltk.core.refactoring.TextEditBasedChange getTextEditBasedChangeDelegate()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||