public interface IDocumentPartitioner
In order to provided backward compatibility for clients of IDocumentPartitioner
, extension
interfaces are used to provide a means of evolution. The following extension interfaces
exist:
IDocumentPartitionerExtension
since version 2.0 replacing
the documentChanged
method with a new one returning the minimal document region
comprising all partition changes.IDocumentPartitionerExtension2
since version 3.0
introducing zero-length partitions in conjunction with the distinction between
open and closed partitions. Also provides inside in the implementation of the partitioner
by exposing the position category used for managing the partitioning information.IDocumentPartitionerExtension3
since version 3.1 introducing
rewrite session. It also replaces the existing connect(IDocument)
method with
a new one: IDocumentPartitionerExtension3.connect(IDocument, boolean)
.
Clients may implement this interface and its extension interfaces or use the standard
implementation DefaultPartitioner
.
Modifier and Type | Method and Description |
---|---|
ITypedRegion[] |
computePartitioning(int offset,
int length)
Returns the partitioning of the given range of the connected
document.
|
void |
connect(IDocument document)
Connects the partitioner to a document.
|
void |
disconnect()
Disconnects the partitioner from the document it is connected to.
|
void |
documentAboutToBeChanged(DocumentEvent event)
Informs about a forthcoming document change.
|
boolean |
documentChanged(DocumentEvent event)
The document has been changed.
|
String |
getContentType(int offset)
Returns the content type of the partition containing the
given offset in the connected document.
|
String[] |
getLegalContentTypes()
Returns the set of all legal content types of this partitioner.
|
ITypedRegion |
getPartition(int offset)
Returns the partition containing the given offset of
the connected document.
|
void connect(IDocument document)
The caller of this method must ensure that this partitioner is also set as the document's document partitioner.
This method has been replaced with IDocumentPartitionerExtension3.connect(IDocument, boolean)
.
Implementers should default a call connect(document)
to
connect(document, false)
in order to sustain the same semantics.
document
- the document to be connected tovoid disconnect()
The caller of this method should also must ensure that this partitioner is no longer the document's partitioner.
void documentAboutToBeChanged(DocumentEvent event)
event
- the event describing the forthcoming changeboolean documentChanged(DocumentEvent event)
This method has been replaced by IDocumentPartitionerExtension.documentChanged2(DocumentEvent)
.
event
- the event describing the document changetrue
if partitioning changedString[] getLegalContentTypes()
String getContentType(int offset)
Use IDocumentPartitionerExtension2.getContentType(int, boolean)
when
zero-length partitions are supported. In that case this method is
equivalent:
IDocumentPartitionerExtension2 extension= (IDocumentPartitionerExtension2) partitioner; return extension.getContentType(offset, false);
offset
- the offset in the connected documentITypedRegion[] computePartitioning(int offset, int length)
Use IDocumentPartitionerExtension2.computePartitioning(int, int, boolean)
when
zero-length partitions are supported. In that case this method is
equivalent:
IDocumentPartitionerExtension2 extension= (IDocumentPartitionerExtension2) partitioner; return extension.computePartitioning(offset, length, false);
offset
- the offset of the range of interestlength
- the length of the range of interestITypedRegion getPartition(int offset)
Use IDocumentPartitionerExtension2.getPartition(int, boolean)
when
zero-length partitions are supported. In that case this method is
equivalent:
IDocumentPartitionerExtension2 extension= (IDocumentPartitionerExtension2) partitioner; return extension.getPartition(offset, false);
offset
- the offset for which to determine the partition
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.