|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.text.rules.DefaultDamagerRepairer
A standard implementation of a syntax driven presentation damager and presentation repairer. It uses a token scanner to scan the document and to determine its damage and new text presentation. The tokens returned by the scanner are supposed to return text attributes as their data.
ITokenScanner
Field Summary | |
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 Summary | |
DefaultDamagerRepairer(ITokenScanner scanner)
Creates a damager/repairer that uses the given scanner. |
|
DefaultDamagerRepairer(ITokenScanner scanner,
TextAttribute defaultTextAttribute)
Deprecated. use DefaultDamagerRepairer(ITokenScanner) instead |
Method Summary | |
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 presentational 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected IDocument fDocument
protected ITokenScanner fScanner
protected TextAttribute fDefaultTextAttribute
Constructor Detail |
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
Method Detail |
public void setDocument(IDocument document)
IPresentationDamager
setDocument
in interface IPresentationDamager
document
- the damager's working documentprotected int endOfLineOf(int offset) throws BadLocationException
offset
- the offset whose line end offset must be computed
BadLocationException
- if offset is invalid in the current documentpublic IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged)
IPresentationDamager
getDamageRegion
in interface IPresentationDamager
partition
- the partition inside which the damage must be determinede
- the event describing the change whose damage must be determined
public 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 determined
protected 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
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |