public class SourceFileChange
extends org.eclipse.ltk.core.refactoring.TextEditBasedChange
TextEditBasedChange that operates on a ISourceFile.| Constructor and Description |
|---|
SourceFileChange(java.lang.String name,
ISourceFile sourceFile)
Creates a source file change that initially contains only an empty root edit.
|
SourceFileChange(java.lang.String name,
ISourceFile sourceFile,
org.eclipse.text.edits.TextEdit edit)
Creates a source file change with the given edit tree.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEdit(org.eclipse.text.edits.TextEdit edit)
Adds the given edit by auto inserting it into the change's edit tree.
|
void |
addEdits(org.eclipse.text.edits.TextEdit[] edits)
Adds the given edits by auto inserting them into the change's edit tree.
|
void |
addGroupedEdits(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup group)
Inserts the edits of the given group into the change's edit tree and
then
adds the group itself to the change. |
void |
addGroupedEdits(org.eclipse.text.edits.TextEditGroup group)
Inserts the edits of the given group into the change's edit tree and
then
adds
the group itself to the change. |
java.lang.Object[] |
getAffectedObjects() |
ISnapshot |
getBase()
Returns the snapshot on which the change's edit tree is based,
or
null if the snapshot is unknown. |
java.lang.String |
getCurrentContent(org.eclipse.core.runtime.IProgressMonitor pm) |
java.lang.String |
getCurrentContent(org.eclipse.jface.text.IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
org.eclipse.core.runtime.IProgressMonitor pm) |
org.eclipse.text.edits.TextEdit |
getEdit()
Returns the root of the change's edit tree.
|
java.lang.Object |
getModifiedElement() |
java.lang.String |
getPreviewContent(org.eclipse.core.runtime.IProgressMonitor pm) |
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) |
org.eclipse.jface.text.IDocument |
getPreviewDocument(org.eclipse.core.runtime.IProgressMonitor pm)
Returns a document containing a preview of this change.
|
org.eclipse.text.edits.TextEdit |
getPreviewEdit(org.eclipse.text.edits.TextEdit original)
Returns the edit that got executed during preview generation
instead of the given original edit.
|
org.eclipse.text.edits.TextEdit[] |
getPreviewEdits(org.eclipse.text.edits.TextEdit[] originals)
Returns the edits that got executed during preview generation
instead of the given array of original edits.
|
SaveMode |
getSaveMode()
Returns the save mode associated with this change.
|
void |
initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm) |
org.eclipse.ltk.core.refactoring.RefactoringStatus |
isValid(org.eclipse.core.runtime.IProgressMonitor pm) |
org.eclipse.ltk.core.refactoring.Change |
perform(org.eclipse.core.runtime.IProgressMonitor pm) |
void |
setBase(ISnapshot base)
Sets the snapshot on which the change's edit tree is based.
|
void |
setKeepPreviewEdits(boolean keep) |
void |
setSaveMode(SaveMode saveMode)
Sets the save mode of this change.
|
addChangeGroup, addTextEditGroup, getChangeGroups, getKeepPreviewEdits, getName, getTextType, hasOneGroupCategory, setEnabled, setTextTypepublic SourceFileChange(java.lang.String name,
ISourceFile sourceFile)
name - the change's name, mainly used to render the change in the UI
- must not be nullsourceFile - the source file this change works on
- must not be nullpublic SourceFileChange(java.lang.String name,
ISourceFile sourceFile,
org.eclipse.text.edits.TextEdit edit)
name - the change's name, mainly used to render the change in the UI
- must not be nullsourceFile - the source file this change works on
- must not be nulledit - the root of the change's edit tree
- must not be nullpublic org.eclipse.text.edits.TextEdit getEdit()
null)public void addEdit(org.eclipse.text.edits.TextEdit edit)
edit - the edit to add - must not be nullorg.eclipse.text.edits.MalformedTreeException - if the edit could not be insertedpublic void addEdits(org.eclipse.text.edits.TextEdit[] edits)
edits - the edits to add - must not be nullorg.eclipse.text.edits.MalformedTreeException - if the edits could not be insertedpublic void addGroupedEdits(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup group)
adds the group itself to the change. Convenience method.group - the group to add - must not be nullorg.eclipse.text.edits.MalformedTreeException - if the edits could not be insertedpublic void addGroupedEdits(org.eclipse.text.edits.TextEditGroup group)
adds
the group itself to the change. Convenience method.group - the group to add - must not be nullorg.eclipse.text.edits.MalformedTreeException - if the edits could not be insertedpublic void setBase(ISnapshot base)
base - the snapshot on which the change is based,
or null if unknownpublic ISnapshot getBase()
null if the snapshot is unknown.null if unknownpublic void setSaveMode(SaveMode saveMode)
saveMode - a save modepublic SaveMode getSaveMode()
public void initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm)
initializeValidationData in class org.eclipse.ltk.core.refactoring.Changepublic org.eclipse.ltk.core.refactoring.RefactoringStatus isValid(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException,
org.eclipse.core.runtime.OperationCanceledException
isValid in class org.eclipse.ltk.core.refactoring.Changeorg.eclipse.core.runtime.CoreExceptionorg.eclipse.core.runtime.OperationCanceledExceptionpublic org.eclipse.ltk.core.refactoring.Change perform(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
perform in class org.eclipse.ltk.core.refactoring.Changeorg.eclipse.core.runtime.CoreExceptionpublic java.lang.Object getModifiedElement()
getModifiedElement in class org.eclipse.ltk.core.refactoring.Changepublic java.lang.Object[] getAffectedObjects()
getAffectedObjects in class org.eclipse.ltk.core.refactoring.Changepublic java.lang.String getCurrentContent(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
getCurrentContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangeorg.eclipse.core.runtime.CoreExceptionpublic 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
getCurrentContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangeorg.eclipse.core.runtime.CoreExceptionpublic java.lang.String getPreviewContent(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
getPreviewContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangeorg.eclipse.core.runtime.CoreExceptionpublic 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
getPreviewContent in class org.eclipse.ltk.core.refactoring.TextEditBasedChangeorg.eclipse.core.runtime.CoreExceptionpublic void setKeepPreviewEdits(boolean keep)
setKeepPreviewEdits in class org.eclipse.ltk.core.refactoring.TextEditBasedChangepublic org.eclipse.text.edits.TextEdit getPreviewEdit(org.eclipse.text.edits.TextEdit original)
setKeepPreviewEdits is set to true and
that a preview has been requested via getPreviewContent
or getPreviewDocument methods.
This method returns null if the original edit is not managed
by this change.
original - the original edit - must not be nullnull
if the original edit is not managed by this changejava.lang.IllegalStateException - if setKeepPreviewEdits is
set to false or a preview has not been requestedpublic org.eclipse.text.edits.TextEdit[] getPreviewEdits(org.eclipse.text.edits.TextEdit[] originals)
setKeepPreviewEdits is set to true
and that a preview has been requested via getPreviewContent
or getPreviewDocument methods.
This method returns an empty array if none of the original edits
is managed by this change. If some of the original edits are not managed
by this change, the length of the returned array will be less than the
length of the given array; the returned array never contains
null elements.
originals - an array of original edits - must not contain
null elementsnull)java.lang.IllegalStateException - if setKeepPreviewEdits is
set to false or a preview has not been requestedpublic org.eclipse.jface.text.IDocument getPreviewDocument(org.eclipse.core.runtime.IProgressMonitor pm)
throws org.eclipse.core.runtime.CoreException
pm - a progress monitor to report progress, or null
if progress reporting is not desired. The caller must not rely on
IProgressMonitor.done() having been called by the receivernull)org.eclipse.core.runtime.CoreException - if the preview could not be createdCopyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0