org.eclipse.xtext.ui.editor.model
Class PartitionTokenScanner

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.model.PartitionTokenScanner
All Implemented Interfaces:
org.eclipse.jface.text.rules.IPartitionTokenScanner, org.eclipse.jface.text.rules.ITokenScanner

public class PartitionTokenScanner
extends java.lang.Object
implements org.eclipse.jface.text.rules.IPartitionTokenScanner

Author:
Sven Efftinge - Initial contribution and API

Constructor Summary
PartitionTokenScanner()
           
 
Method Summary
 int getTokenLength()
          Returns the length of the last token read by this scanner.
 int getTokenOffset()
          Returns the offset of the last token read by this scanner.
protected  java.lang.Iterable<ILexerTokenRegion> getTokens(org.eclipse.jface.text.IDocument document)
           
 org.eclipse.jface.text.rules.IToken nextToken()
          Returns the next token in the document.
 void setMapper(ITokenTypeToPartitionTypeMapper mapper)
           
 void setPartialRange(org.eclipse.jface.text.IDocument document, int offset, int length, java.lang.String contentType, int partitionOffset)
          Configures the scanner by providing access to the document range that should be scanned.
 void setRange(org.eclipse.jface.text.IDocument document, int offset, int length)
          Configures the scanner by providing access to the document range that should be scanned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartitionTokenScanner

public PartitionTokenScanner()
Method Detail

setMapper

public void setMapper(ITokenTypeToPartitionTypeMapper mapper)

setRange

public void setRange(org.eclipse.jface.text.IDocument document,
                     int offset,
                     int length)
Description copied from interface: org.eclipse.jface.text.rules.ITokenScanner
Configures the scanner by providing access to the document range that should be scanned.

Specified by:
setRange in interface org.eclipse.jface.text.rules.ITokenScanner
Parameters:
document - the document to scan
offset - the offset of the document range to scan
length - the length of the document range to scan

setPartialRange

public void setPartialRange(org.eclipse.jface.text.IDocument document,
                            int offset,
                            int length,
                            java.lang.String contentType,
                            int partitionOffset)
Description copied from interface: org.eclipse.jface.text.rules.IPartitionTokenScanner
Configures the scanner by providing access to the document range that should be scanned. The range may no only contain complete partitions but starts at the beginning of a line in the middle of a partition of the given content type. This requires that a partition delimiter can not contain a line delimiter.

Specified by:
setPartialRange in interface org.eclipse.jface.text.rules.IPartitionTokenScanner
Parameters:
document - the document to scan
offset - the offset of the document range to scan
length - the length of the document range to scan
contentType - the content type at the given offset
partitionOffset - the offset at which the partition of the given offset starts

getTokens

protected java.lang.Iterable<ILexerTokenRegion> getTokens(org.eclipse.jface.text.IDocument document)

nextToken

public org.eclipse.jface.text.rules.IToken nextToken()
Description copied from interface: org.eclipse.jface.text.rules.ITokenScanner
Returns the next token in the document.

Specified by:
nextToken in interface org.eclipse.jface.text.rules.ITokenScanner
Returns:
the next token in the document

getTokenOffset

public int getTokenOffset()
Description copied from interface: org.eclipse.jface.text.rules.ITokenScanner
Returns the offset of the last token read by this scanner.

Specified by:
getTokenOffset in interface org.eclipse.jface.text.rules.ITokenScanner
Returns:
the offset of the last token read by this scanner

getTokenLength

public int getTokenLength()
Description copied from interface: org.eclipse.jface.text.rules.ITokenScanner
Returns the length of the last token read by this scanner.

Specified by:
getTokenLength in interface org.eclipse.jface.text.rules.ITokenScanner
Returns:
the length of the last token read by this scanner