public abstract class TextEditBasedChange extends Change
Modifier | Constructor and Description |
---|---|
protected |
TextEditBasedChange(String name)
Creates a new abstract text edit change with the specified name.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeGroup(TextEditBasedChangeGroup group)
Adds a
text edit change group . |
void |
addTextEditGroup(TextEditGroup group)
Adds a
text edit group . |
TextEditBasedChangeGroup[] |
getChangeGroups()
Returns the
text edit change groups managed by this
buffer change. |
abstract String |
getCurrentContent(IProgressMonitor pm)
Returns the current content of the document this text
change is associated with.
|
abstract String |
getCurrentContent(IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
IProgressMonitor pm)
Returns the current content of the text edit change clipped to a specific
region.
|
boolean |
getKeepPreviewEdits()
Returns whether preview edits are remembered for further region
tracking or not.
|
String |
getName()
Returns the human readable name of this change.
|
abstract String |
getPreviewContent(IProgressMonitor pm)
Returns the preview content as a string.
|
abstract String |
getPreviewContent(TextEditBasedChangeGroup[] changeGroups,
IRegion region,
boolean expandRegionToFullLine,
int surroundingLines,
IProgressMonitor pm)
Returns a preview of the text edit change clipped to a specific region.
|
String |
getTextType()
Returns the text edit change's text type.
|
boolean |
hasOneGroupCategory(List groupCategories)
Returns
true if the change has one of the given group
categories. |
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(String type)
Sets the text type.
|
dispose, getAdapter, getAffectedObjects, getDescriptor, getModifiedElement, getParent, initializeValidationData, isEnabled, isValid, perform, setEnabledShallow
protected TextEditBasedChange(String name)
null
.
The text type of this text edit change is set to txt
.
name
- the name of the text edit changesetTextType(String)
public void addChangeGroup(TextEditBasedChangeGroup group)
text edit change group
.
The edits managed by the given text edit change group must be part of
the change's root edit.group
- the text edit change group to addpublic void addTextEditGroup(TextEditGroup group)
text edit group
. This method is a convenience
method for calling change.addChangeGroup(new
TextEditBasedChangeGroup(change, group));
.group
- the text edit group to addpublic boolean hasOneGroupCategory(List groupCategories)
true
if the change has one of the given group
categories. Otherwise false
is returned.groupCategories
- the group categories to checkpublic final TextEditBasedChangeGroup[] getChangeGroups()
text edit change groups
managed by this
buffer change.public abstract String getCurrentContent(IProgressMonitor pm) throws CoreException
pm
- a progress monitor to report progress or null
if no progress reporting is desiredCoreException
- if the content can't be accessedpublic abstract String getCurrentContent(IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm) throws CoreException
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
region
- 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 true
pm
- a progress monitor to report progress or null
if no progress reporting is desiredCoreException
- if an exception occurs while accessing the current contentpublic boolean getKeepPreviewEdits()
true
if executed text edits are remembered
during preview generation; otherwise false
public String getName()
null
.public abstract String getPreviewContent(TextEditBasedChangeGroup[] changeGroups, IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm) throws CoreException
text 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
changeGroups
- 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 true
pm
- a progress monitor to report progress or null
if no progress reporting is desiredCoreException
- if an exception occurs while generating the previewgetCurrentContent(IRegion, boolean, int, IProgressMonitor)
public abstract String getPreviewContent(IProgressMonitor pm) throws CoreException
pm
- a progress monitor to report progress or null
if no progress reporting is desiredCoreException
- if the preview can't be createdpublic String getTextType()
public void setEnabled(boolean enabled)
setEnabled
in class Change
enabled
- true
to enable this change;
false
otherwisepublic void setKeepPreviewEdits(boolean keep)
keep
- if true
executed preview edits are keptpublic void setTextType(String type)
org.eclipse.compare.contentMergeViewers
.
The default text type is txt
.
type
- the text type. If null
is passed the text type is
reseted to the default text type txt
.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.