public class TextPresentation extends Object
All iterators provided by a text presentation assume that they enumerate non
overlapping, consecutive ranges inside the default range. Thus, all these
iterators do not include the default range. The default style range must be
explicitly asked for using getDefaultStyleRange
.
Constructor and Description |
---|
TextPresentation()
Creates a new empty text presentation.
|
TextPresentation(int sizeHint)
Creates a new empty text presentation.
|
TextPresentation(IRegion extent,
int sizeHint)
Creates a new empty text presentation with the given extent.
|
Modifier and Type | Method and Description |
---|---|
void |
addStyleRange(StyleRange range)
Add the given range to the presentation.
|
static void |
applyTextPresentation(TextPresentation presentation,
StyledText text)
Applies the given presentation to the given text widget.
|
void |
clear()
Clears this presentation by resetting all applied changes.
|
Iterator |
getAllStyleRangeIterator()
Returns an iterator which enumerates all style ranges of this presentation
except the default style range.
|
IRegion |
getCoverage()
Returns the coverage of this presentation as clipped by the presentation's
result window.
|
StyleRange |
getDefaultStyleRange()
Returns this presentation's default style range.
|
int |
getDenumerableRanges()
Returns the number of style ranges in the presentation not counting the default
style range.
|
IRegion |
getExtent()
Returns the extent of this presentation clipped by the
presentation's result window.
|
StyleRange |
getFirstStyleRange()
Returns the style range with the smallest offset ignoring the default style range or null
if the presentation is empty.
|
StyleRange |
getLastStyleRange()
Returns the style range with the highest offset ignoring the default style range.
|
Iterator |
getNonDefaultStyleRangeIterator()
Returns an iterator which enumerates all style ranged which define a style
different from the presentation's default style range.
|
boolean |
isEmpty()
Returns whether this collection contains any style range including
the default style range.
|
void |
mergeStyleRange(StyleRange range)
Merges the given range into this presentation.
|
void |
mergeStyleRanges(StyleRange[] ranges)
Merges the given ranges into this presentation.
|
void |
replaceStyleRange(StyleRange range)
Replaces the given range in this presentation.
|
void |
replaceStyleRanges(StyleRange[] ranges)
Replaces the given ranges in this presentation.
|
void |
setDefaultStyleRange(StyleRange range)
Set the default style range of this presentation.
|
void |
setResultWindow(IRegion resultWindow)
Sets the result window for this presentation.
|
public TextPresentation()
public TextPresentation(int sizeHint)
sizeHint
tells the expected size of this
presentation.sizeHint
- the expected size of this presentation, must be positivepublic TextPresentation(IRegion extent, int sizeHint)
sizeHint
tells the
expected size of this presentation.extent
- the extent of the created TextPresentation
sizeHint
- the expected size of this presentation, must be positivepublic static void applyTextPresentation(TextPresentation presentation, StyledText text)
presentation
- the style informationtext
- the widget to which to apply the style informationpublic void setResultWindow(IRegion resultWindow)
resultWindow
- the result windowpublic void setDefaultStyleRange(StyleRange range)
range
- the range describing the default regionpublic StyleRange getDefaultStyleRange()
StyleRange
is relative to the start of the result window.public void addStyleRange(StyleRange range)
range
- the range to be addedpublic void replaceStyleRange(StyleRange range)
range
- the range to be addedpublic void mergeStyleRange(StyleRange range)
range
- the range to be addedpublic void replaceStyleRanges(StyleRange[] ranges)
ranges
- the ranges to be addedpublic void mergeStyleRanges(StyleRange[] ranges)
ranges
- the ranges to be addedpublic Iterator getNonDefaultStyleRangeIterator()
public Iterator getAllStyleRangeIterator()
StyleRange
s
are relative to the start of the presentation's result window.public boolean isEmpty()
true
if there is no style range in this presentationpublic int getDenumerableRanges()
public StyleRange getFirstStyleRange()
public StyleRange getLastStyleRange()
public IRegion getCoverage()
public IRegion getExtent()
public void clear()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.