public class DefaultDamagerRepairer extends Object implements IPresentationDamager, IPresentationRepairer
ITokenScanner
Modifier and Type | Field and Description |
---|---|
protected TextAttribute |
fDefaultTextAttribute
The default text attribute if non is returned as data by the current token
|
protected IDocument |
fDocument
The document this object works on
|
protected ITokenScanner |
fScanner
The scanner it uses
|
Constructor and Description |
---|
DefaultDamagerRepairer(ITokenScanner scanner)
Creates a damager/repairer that uses the given scanner.
|
DefaultDamagerRepairer(ITokenScanner scanner,
TextAttribute defaultTextAttribute)
Deprecated.
use DefaultDamagerRepairer(ITokenScanner) instead
|
Modifier and Type | Method and Description |
---|---|
protected void |
addRange(TextPresentation presentation,
int offset,
int length,
TextAttribute attr)
Adds style information to the given text presentation.
|
void |
createPresentation(TextPresentation presentation,
ITypedRegion region)
Fills the given presentation with the style ranges which when applied to the
presentation reconciler's text viewer repair the presentation damage described by
the given region.
|
protected int |
endOfLineOf(int offset)
Returns the end offset of the line that contains the specified offset or
if the offset is inside a line delimiter, the end offset of the next line.
|
IRegion |
getDamageRegion(ITypedRegion partition,
DocumentEvent e,
boolean documentPartitioningChanged)
Returns the damage in the document's presentation caused by the given document change.
|
protected TextAttribute |
getTokenTextAttribute(IToken token)
Returns a text attribute encoded in the given token.
|
void |
setDocument(IDocument document)
Tells the presentation damager on which document it will work.
|
protected IDocument fDocument
protected ITokenScanner fScanner
protected TextAttribute fDefaultTextAttribute
@Deprecated public DefaultDamagerRepairer(ITokenScanner scanner, TextAttribute defaultTextAttribute)
scanner
- the token scanner to be useddefaultTextAttribute
- the text attribute to be returned if non is specified by the current token,
may not be null
public DefaultDamagerRepairer(ITokenScanner scanner)
null
and is assumed to return only token that carry text attributes.scanner
- the token scanner to be used, may not be null
public void setDocument(IDocument document)
IPresentationDamager
setDocument
in interface IPresentationDamager
setDocument
in interface IPresentationRepairer
document
- the damager's working documentprotected int endOfLineOf(int offset) throws BadLocationException
offset
- the offset whose line end offset must be computedBadLocationException
- if offset is invalid in the current documentpublic IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged)
This implementation damages entire lines unless clipped by the given partition.
getDamageRegion
in interface IPresentationDamager
partition
- the partition inside which the damage must be determinede
- the event describing the change whose damage must be determineddocumentPartitioningChanged
- indicates whether the given change changed the document's partitioningpublic void createPresentation(TextPresentation presentation, ITypedRegion region)
IPresentationRepairer
createPresentation
in interface IPresentationRepairer
presentation
- the text presentation to be filled by this repairerregion
- the damage to be repairedprotected TextAttribute getTokenTextAttribute(IToken token)
null
and a text attribute it is assumed that
it is the encoded text attribute. It returns the default text attribute
if there is no encoded text attribute found.token
- the token whose text attribute is to be determinedprotected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr)
presentation
- the text presentation to be extendedoffset
- the offset of the range to be styledlength
- the length of the range to be styledattr
- the attribute describing the style of the range to be styled
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.