Class DefaultDamagerRepairer2
- java.lang.Object
 - 
- org.eclipse.epsilon.common.dt.editor.DefaultDamagerRepairer2
 
 
- 
- All Implemented Interfaces:
 org.eclipse.jface.text.presentation.IPresentationDamager,org.eclipse.jface.text.presentation.IPresentationRepairer
public class DefaultDamagerRepairer2 extends java.lang.Object implements org.eclipse.jface.text.presentation.IPresentationDamager, org.eclipse.jface.text.presentation.IPresentationRepairerA 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.- Since:
 - 2.0
 - See Also:
 ITokenScanner
 
- 
- 
Field Summary
Fields Modifier and Type Field Description org.eclipse.jface.text.TextAttributefDefaultTextAttributeThe default text attribute if non is returned as data by the current tokenprotected org.eclipse.jface.text.IDocumentfDocumentThe document this object works onprotected org.eclipse.jface.text.rules.ITokenScannerfScannerThe scanner it uses 
- 
Constructor Summary
Constructors Constructor Description DefaultDamagerRepairer2(org.eclipse.jface.text.rules.ITokenScanner scanner)Creates a damager/repairer that uses the given scanner.DefaultDamagerRepairer2(org.eclipse.jface.text.rules.ITokenScanner scanner, org.eclipse.jface.text.TextAttribute defaultTextAttribute)Deprecated.use DefaultDamagerRepairer(ITokenScanner) instead 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRange(org.eclipse.jface.text.TextPresentation presentation, int offset, int length, org.eclipse.jface.text.TextAttribute attr)Adds style information to the given text presentation.voidcreatePresentation(org.eclipse.jface.text.TextPresentation presentation, org.eclipse.jface.text.ITypedRegion region)protected intendOfLineOf(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.org.eclipse.jface.text.IRegiongetDamageRegion(org.eclipse.jface.text.ITypedRegion partition, org.eclipse.jface.text.DocumentEvent e, boolean documentPartitioningChanged)protected org.eclipse.jface.text.TextAttributegetTokenTextAttribute(org.eclipse.jface.text.rules.IToken token)Returns a text attribute encoded in the given token.voidsetDocument(org.eclipse.jface.text.IDocument document) 
 - 
 
- 
- 
Field Detail
- 
fDocument
protected org.eclipse.jface.text.IDocument fDocument
The document this object works on 
- 
fScanner
protected org.eclipse.jface.text.rules.ITokenScanner fScanner
The scanner it uses 
- 
fDefaultTextAttribute
public org.eclipse.jface.text.TextAttribute fDefaultTextAttribute
The default text attribute if non is returned as data by the current token 
 - 
 
- 
Constructor Detail
- 
DefaultDamagerRepairer2
@Deprecated public DefaultDamagerRepairer2(org.eclipse.jface.text.rules.ITokenScanner scanner, org.eclipse.jface.text.TextAttribute defaultTextAttribute)Deprecated.use DefaultDamagerRepairer(ITokenScanner) insteadCreates a damager/repairer that uses the given scanner and returns the given default text attribute if the current token does not carry a text attribute.- Parameters:
 scanner- the token scanner to be useddefaultTextAttribute- the text attribute to be returned if non is specified by the current token, may not benull
 
- 
DefaultDamagerRepairer2
public DefaultDamagerRepairer2(org.eclipse.jface.text.rules.ITokenScanner scanner)
Creates a damager/repairer that uses the given scanner. The scanner may not benulland is assumed to return only token that carry text attributes.- Parameters:
 scanner- the token scanner to be used, may not benull
 
 - 
 
- 
Method Detail
- 
setDocument
public void setDocument(org.eclipse.jface.text.IDocument document)
- Specified by:
 setDocumentin interfaceorg.eclipse.jface.text.presentation.IPresentationDamager- Specified by:
 setDocumentin interfaceorg.eclipse.jface.text.presentation.IPresentationRepairer
 
- 
endOfLineOf
protected int endOfLineOf(int offset) throws org.eclipse.jface.text.BadLocationExceptionReturns 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.- Parameters:
 offset- the offset whose line end offset must be computed- Returns:
 - the line end offset for the given offset
 - Throws:
 org.eclipse.jface.text.BadLocationException- if offset is invalid in the current document
 
- 
getDamageRegion
public org.eclipse.jface.text.IRegion getDamageRegion(org.eclipse.jface.text.ITypedRegion partition, org.eclipse.jface.text.DocumentEvent e, boolean documentPartitioningChanged)- Specified by:
 getDamageRegionin interfaceorg.eclipse.jface.text.presentation.IPresentationDamager
 
- 
createPresentation
public void createPresentation(org.eclipse.jface.text.TextPresentation presentation, org.eclipse.jface.text.ITypedRegion region)- Specified by:
 createPresentationin interfaceorg.eclipse.jface.text.presentation.IPresentationRepairer
 
- 
getTokenTextAttribute
protected org.eclipse.jface.text.TextAttribute getTokenTextAttribute(org.eclipse.jface.text.rules.IToken token)
Returns a text attribute encoded in the given token. If the token's data is notnulland 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.- Parameters:
 token- the token whose text attribute is to be determined- Returns:
 - the token's text attribute
 
 
- 
addRange
protected void addRange(org.eclipse.jface.text.TextPresentation presentation, int offset, int length, org.eclipse.jface.text.TextAttribute attr)Adds style information to the given text presentation.- Parameters:
 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
 
 - 
 
 -