|
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.RuleBasedPartitioner
DefaultPartitioner
instead
A standard implementation of a syntax driven document partitioner. It uses a rule based scanner to scan the document and to determine the document's partitioning. The tokens returned by the rules the scanner is configured with are supposed to return the partition type as their data. The partitioner remembers the document's partitions in the document itself rather than maintaining its own data structure.
IRule
,
RuleBasedScanner
Field Summary | |
static String |
CONTENT_TYPES_CATEGORY
Deprecated. The position category this partitioner uses to store the document's partitioning information |
protected int |
fDeleteOffset
Deprecated. The offset at which a partition has been deleted |
protected IDocument |
fDocument
Deprecated. The partitioner's document |
protected int |
fEndOffset
Deprecated. The offset at which the last changed partition ends |
protected String[] |
fLegalContentTypes
Deprecated. The legal content types of this partitioner |
protected DefaultPositionUpdater |
fPositionUpdater
Deprecated. The position updater used to for the default updating of partitions |
protected int |
fPreviousDocumentLength
Deprecated. The document length before a document change occured |
protected RuleBasedScanner |
fScanner
Deprecated. The partitioner's scanner |
protected int |
fStartOffset
Deprecated. The offset at which the first changed partition starts |
Constructor Summary | |
RuleBasedPartitioner(RuleBasedScanner scanner,
String[] legalContentTypes)
Deprecated. Creates a new partitioner that uses the given scanner and may return partitions of the given legal content types. |
Method Summary | |
ITypedRegion[] |
computePartitioning(int offset,
int length)
Deprecated. Returns the partitioning of the given range of the connected document. |
void |
connect(IDocument document)
Deprecated. Connects the partitioner to a document. |
void |
disconnect()
Deprecated. Disconnects the partitioner from the document it is connected to. |
void |
documentAboutToBeChanged(DocumentEvent e)
Deprecated. Informs about a forthcoming document change. |
boolean |
documentChanged(DocumentEvent e)
Deprecated. The document has been changed. |
IRegion |
documentChanged2(DocumentEvent e)
Deprecated. The document has been changed. |
protected TypedPosition |
findClosestPosition(int offset)
Deprecated. Returns the position in the partitoner's position category which is close to the given offset. |
String |
getContentType(int offset)
Deprecated. Returns the content type of the partition containing the given offset in the connected document. |
String[] |
getLegalContentTypes()
Deprecated. Returns the set of all legal content types of this partitioner. |
ITypedRegion |
getPartition(int offset)
Deprecated. Returns the partition containing the given offset of the connected document. |
protected String |
getTokenContentType(IToken token)
Deprecated. Returns a content type encoded in the given token. |
protected void |
initialize()
Deprecated. Performs the initial partitioning of the partitioner's document. |
protected boolean |
isSupportedContentType(String contentType)
Deprecated. Returns whether the given type is one of the legal content types. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String CONTENT_TYPES_CATEGORY
protected RuleBasedScanner fScanner
protected String[] fLegalContentTypes
protected IDocument fDocument
protected int fPreviousDocumentLength
protected DefaultPositionUpdater fPositionUpdater
protected int fStartOffset
protected int fEndOffset
protected int fDeleteOffset
Constructor Detail |
public RuleBasedPartitioner(RuleBasedScanner scanner, String[] legalContentTypes)
scanner
- the scanner this partitioner is supposed to uselegalContentTypes
- the legal content types of this partitionerMethod Detail |
public void connect(IDocument document)
IDocumentPartitioner
The caller of this method must ensure that this partitioner is also set as the document's document partitioner.
connect
in interface IDocumentPartitioner
document
- the document to be connected toprotected void initialize()
public void disconnect()
IDocumentPartitioner
The caller of this method should also must ensure that this partitioner is no longer the document's partitioner.
disconnect
in interface IDocumentPartitioner
public void documentAboutToBeChanged(DocumentEvent e)
IDocumentPartitioner
documentAboutToBeChanged
in interface IDocumentPartitioner
e
- the event describing the forthcoming changepublic boolean documentChanged(DocumentEvent e)
IDocumentPartitioner
documentChanged
in interface IDocumentPartitioner
e
- the event describing the document change
true
if partitioning changedpublic IRegion documentChanged2(DocumentEvent e)
IDocumentPartitionerExtension
documentChanged2
in interface IDocumentPartitionerExtension
e
- the event describing the document change
protected TypedPosition findClosestPosition(int offset)
offset
- the offset for which to search the closest position
public String getContentType(int offset)
IDocumentPartitioner
getContentType
in interface IDocumentPartitioner
offset
- the offset in the connected document
public ITypedRegion getPartition(int offset)
IDocumentPartitioner
getPartition
in interface IDocumentPartitioner
offset
- the offset for which to determine the partition
public ITypedRegion[] computePartitioning(int offset, int length)
IDocumentPartitioner
computePartitioning
in interface IDocumentPartitioner
offset
- the offset of the range of interestlength
- the length of the range of interest
public String[] getLegalContentTypes()
IDocumentPartitioner
getLegalContentTypes
in interface IDocumentPartitioner
protected boolean isSupportedContentType(String contentType)
contentType
- the content type to check
true
if the content type is a legal content typeprotected String getTokenContentType(IToken token)
null
and a string it is assumed that
it is the encoded content type.
token
- the token whose content type is to be determined
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |