Class BmObjectTextContentChange<T extends org.eclipse.emf.ecore.EObject>
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.Change
-
- org.eclipse.ltk.core.refactoring.TextEditBasedChange
-
- com._1c.g5.v8.dt.refactoring.core.ltk.BmObjectTextContentChange<T>
-
- Type Parameters:
T
- class which attribute will be changed by thisChange
- All Implemented Interfaces:
IFullTextSearchChange
,IProjectAwareChange
,org.eclipse.core.runtime.IAdaptable
public class BmObjectTextContentChange<T extends org.eclipse.emf.ecore.EObject> extends org.eclipse.ltk.core.refactoring.TextEditBasedChange implements IProjectAwareChange, IFullTextSearchChange
TextEditBasedChange
for text content attribute ofEObject
. Provides mechanism for show changes in text content in preview page
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.text.edits.TextEdit
edit
TextEdit
s for change text contentprotected org.eclipse.emf.ecore.EStructuralFeature
feature
EStructuralFeature
corresponding to the text content attributeprotected T
object
Object with text content attribute
-
Constructor Summary
Constructors Constructor Description BmObjectTextContentChange(String name, T object, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.text.edits.TextEdit edit)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEdit(org.eclipse.text.edits.TextEdit edit)
Inserts the given edit into the change's edit tree.void
addEdits(org.eclipse.text.edits.TextEdit[] edits)
Inserts the given edits 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 thenadds
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 thenadds
the group itself to the change.void
dispose()
Object[]
getAffectedObjects()
String
getCurrentContent(org.eclipse.core.runtime.IProgressMonitor pm)
String
getCurrentContent(org.eclipse.jface.text.IRegion region, boolean expandRegionToFullLine, int surroundingLines, org.eclipse.core.runtime.IProgressMonitor pm)
org.eclipse.text.edits.TextEdit
getEdit()
Object
getModifiedElement()
String
getPreviewContent(org.eclipse.core.runtime.IProgressMonitor pm)
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 the text 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.org.eclipse.text.edits.TextEdit[]
getPreviewEdits(org.eclipse.text.edits.TextEdit[] originals)
Returns the edits that were executed during preview generation instead of the given array of original edits.String
getProjectName()
Gets name of the affected projectvoid
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
setKeepPreviewEdits(boolean keep)
-
Methods inherited from class org.eclipse.ltk.core.refactoring.TextEditBasedChange
addChangeGroup, addTextEditGroup, getChangeGroups, getKeepPreviewEdits, getName, getTextType, hasOneGroupCategory, setEnabled, setTextType
-
-
-
-
Field Detail
-
object
protected T extends org.eclipse.emf.ecore.EObject object
Object with text content attribute
-
feature
protected org.eclipse.emf.ecore.EStructuralFeature feature
EStructuralFeature
corresponding to the text content attribute
-
edit
protected org.eclipse.text.edits.TextEdit edit
TextEdit
s for change text content
-
-
Constructor Detail
-
BmObjectTextContentChange
public BmObjectTextContentChange(String name, T object, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.text.edits.TextEdit edit)
Constructor- Parameters:
name
- name of the change, can't benull
object
- object which attribute will be changed by thisChange
, can't benull
feature
-EStructuralFeature
corresponding to the changing text content, can't benull
edit
-TextEdit
describes how text content will be changed, can't benull
-
-
Method Detail
-
getProjectName
public String getProjectName()
Description copied from interface:IProjectAwareChange
Gets name of the affected project- Specified by:
getProjectName
in interfaceIProjectAwareChange
- Returns:
- name of the affected project, can be
null
if there is no affected project
-
getCurrentContent
public String getCurrentContent(org.eclipse.core.runtime.IProgressMonitor pm) throws org.eclipse.core.runtime.CoreException
- Specified by:
getCurrentContent
in classorg.eclipse.ltk.core.refactoring.TextEditBasedChange
- Throws:
org.eclipse.core.runtime.CoreException
-
getCurrentContent
public String getCurrentContent(org.eclipse.jface.text.IRegion region, boolean expandRegionToFullLine, int surroundingLines, org.eclipse.core.runtime.IProgressMonitor pm) throws org.eclipse.core.runtime.CoreException
- Specified by:
getCurrentContent
in classorg.eclipse.ltk.core.refactoring.TextEditBasedChange
- Throws:
org.eclipse.core.runtime.CoreException
-
getPreviewContent
public String getPreviewContent(org.eclipse.core.runtime.IProgressMonitor pm) throws org.eclipse.core.runtime.CoreException
- Specified by:
getPreviewContent
in classorg.eclipse.ltk.core.refactoring.TextEditBasedChange
- Throws:
org.eclipse.core.runtime.CoreException
-
setKeepPreviewEdits
public void setKeepPreviewEdits(boolean keep)
- Overrides:
setKeepPreviewEdits
in classorg.eclipse.ltk.core.refactoring.TextEditBasedChange
-
getPreviewEdit
public 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. The method requires thatsetKeepPreviewEdits
is set totrue
and that a preview has been requested via one of thegetPreview*
methods.The method returns
null
if the original isn't managed by this text change.- Parameters:
original
- the original edit managed by this text change, can't benull
- Returns:
- the edit executed during preview generation, never
null
-
getPreviewEdits
public org.eclipse.text.edits.TextEdit[] getPreviewEdits(org.eclipse.text.edits.TextEdit[] originals)
Returns the edits that were executed during preview generation instead of the given array of original edits. The method requires thatsetKeepPreviewEdits
is set totrue
and that a preview has been requested via one of thegetPreview*
methods.The method returns an empty array if none of the original edits is managed by this text change.
- Parameters:
originals
- an array of original edits managed by this text change, can't benull
- Returns:
- an array of edits containing the corresponding edits
executed during preview generation, never
null
-
getPreviewDocument
public org.eclipse.jface.text.IDocument getPreviewDocument(org.eclipse.core.runtime.IProgressMonitor pm) throws org.eclipse.core.runtime.CoreException
Returns a document containing a preview of the text change. The preview is computed by executing the all managed text edits. The method considers the active state of the addedtext edit change groups
.- Parameters:
pm
- a progress monitor to report progress ornull
if no progress reporting is desired, can't benull
- Returns:
- a document containing the preview of the text change, never
null
- Throws:
org.eclipse.core.runtime.CoreException
- if the preview can't be created
-
getPreviewContent
public 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
- Specified by:
getPreviewContent
in classorg.eclipse.ltk.core.refactoring.TextEditBasedChange
- Throws:
org.eclipse.core.runtime.CoreException
-
initializeValidationData
public void initializeValidationData(org.eclipse.core.runtime.IProgressMonitor pm)
- Specified by:
initializeValidationData
in classorg.eclipse.ltk.core.refactoring.Change
-
isValid
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
- Specified by:
isValid
in classorg.eclipse.ltk.core.refactoring.Change
- Throws:
org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.OperationCanceledException
-
perform
public org.eclipse.ltk.core.refactoring.Change perform(org.eclipse.core.runtime.IProgressMonitor pm) throws org.eclipse.core.runtime.CoreException
- Specified by:
perform
in classorg.eclipse.ltk.core.refactoring.Change
- Throws:
org.eclipse.core.runtime.CoreException
-
getModifiedElement
public Object getModifiedElement()
- Specified by:
getModifiedElement
in classorg.eclipse.ltk.core.refactoring.Change
-
getEdit
public org.eclipse.text.edits.TextEdit getEdit()
- Returns:
- the root of the change's edit tree (never
null
)
-
addEdit
public void addEdit(org.eclipse.text.edits.TextEdit edit)
Inserts the given edit into the change's edit tree.- Parameters:
edit
- the edit to insert - must not benull
- Throws:
org.eclipse.text.edits.MalformedTreeException
- if edit can't be inserted
-
addEdits
public void addEdits(org.eclipse.text.edits.TextEdit[] edits)
Inserts the given edits into the change's edit tree.- Parameters:
edits
- the edits to insert - must not benull
- Throws:
org.eclipse.text.edits.MalformedTreeException
- if edits can't be inserted
-
addGroupedEdits
public void addGroupedEdits(org.eclipse.ltk.core.refactoring.TextEditBasedChangeGroup group)
Inserts the edits of the given group into the change's edit tree and thenadds
the group itself to the change.- Parameters:
group
- the group to add - must not benull
- Throws:
org.eclipse.text.edits.MalformedTreeException
- if edits can't be inserted
-
addGroupedEdits
public void addGroupedEdits(org.eclipse.text.edits.TextEditGroup group)
Inserts the edits of the given group into the change's edit tree and thenadds
the group itself to the change.- Parameters:
group
- the group to add - must not benull
- Throws:
org.eclipse.text.edits.MalformedTreeException
- if edits can't be inserted
-
dispose
public void dispose()
- Overrides:
dispose
in classorg.eclipse.ltk.core.refactoring.Change
-
getAffectedObjects
public Object[] getAffectedObjects()
- Overrides:
getAffectedObjects
in classorg.eclipse.ltk.core.refactoring.Change
-
-