FastPartitioner
instead@Deprecated public class DefaultPartitioner extends Object implements IDocumentPartitioner, IDocumentPartitionerExtension, IDocumentPartitionerExtension2, IDocumentPartitionerExtension3
IPartitionTokenScanner
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_TYPES_CATEGORY
Deprecated.
As of 3.0, use
getManagingPositionCategories() instead. |
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 occurred
|
protected IPartitionTokenScanner |
fScanner
Deprecated.
The partitioner's scanner
|
protected int |
fStartOffset
Deprecated.
The offset at which the first changed partition starts
|
Constructor and Description |
---|
DefaultPartitioner(IPartitionTokenScanner scanner,
String[] legalContentTypes)
Deprecated.
Creates a new partitioner that uses the given scanner and may return
partitions of the given legal content types.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkInitialization()
Deprecated.
|
ITypedRegion[] |
computePartitioning(int offset,
int length)
Deprecated.
Returns the partitioning of the given range of the connected
document.
|
ITypedRegion[] |
computePartitioning(int offset,
int length,
boolean includeZeroLengthPartitions)
Deprecated.
Returns the partitioning of the given range of the connected document.
|
void |
connect(IDocument document)
Deprecated.
Connects the partitioner to a document.
|
void |
connect(IDocument document,
boolean delayInitialization)
Deprecated.
Connects this 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.
|
protected void |
flushRewriteSession()
Deprecated.
Flushes the active rewrite session.
|
DocumentRewriteSession |
getActiveRewriteSession()
Deprecated.
Returns the active rewrite session of this document or
null . |
String |
getContentType(int offset)
Deprecated.
Returns the content type of the partition containing the
given offset in the connected document.
|
String |
getContentType(int offset,
boolean preferOpenPartitions)
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.
|
String[] |
getManagingPositionCategories()
Deprecated.
Returns the position categories that this partitioners uses in order to manage
the partitioning information of the documents.
|
ITypedRegion |
getPartition(int offset)
Deprecated.
Returns the partition containing the given offset of
the connected document.
|
ITypedRegion |
getPartition(int offset,
boolean preferOpenPartitions)
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.
|
void |
startRewriteSession(DocumentRewriteSession session)
Deprecated.
Tells the document partitioner that a rewrite session started.
|
void |
stopRewriteSession(DocumentRewriteSession session)
Deprecated.
Tells the document partitioner that the rewrite session has finished.
|
@Deprecated public static final String CONTENT_TYPES_CATEGORY
getManagingPositionCategories()
instead.protected IPartitionTokenScanner fScanner
protected String[] fLegalContentTypes
protected IDocument fDocument
protected int fPreviousDocumentLength
protected DefaultPositionUpdater fPositionUpdater
protected int fStartOffset
protected int fEndOffset
protected int fDeleteOffset
public DefaultPartitioner(IPartitionTokenScanner scanner, String[] legalContentTypes)
scanner
- the scanner this partitioner is supposed to uselegalContentTypes
- the legal content types of this partitionerpublic String[] getManagingPositionCategories()
IDocumentPartitionerExtension2
null
if
no position category is used.getManagingPositionCategories
in interface IDocumentPartitionerExtension2
null
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.
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.
connect
in interface IDocumentPartitioner
document
- the document to be connected topublic void connect(IDocument document, boolean delayInitialization)
IDocumentPartitionerExtension3
The caller of this method must ensure that this partitioner is also set as the document's document partitioner.
delayInitialization
indicates whether the partitioner is
allowed to delay it initial computation of the document's partitioning
until it has to answer the first query.
Replaces IDocumentPartitioner.connect(IDocument)
.
connect
in interface IDocumentPartitionerExtension3
document
- the document to be connected todelayInitialization
- true
if initialization can be delayed, false
otherwiseprotected final void checkInitialization()
protected 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
This method has been replaced by IDocumentPartitionerExtension.documentChanged2(DocumentEvent)
.
documentChanged
in interface IDocumentPartitioner
e
- the event describing the document changetrue
if partitioning changedpublic IRegion documentChanged2(DocumentEvent e)
IDocumentPartitionerExtension
null
if the partitioning did not change.
Will be called by the connected document and is not intended to be used by clients other than the connected document.
Replaces IDocumentPartitioner.documentChanged(DocumentEvent)
.
documentChanged2
in interface IDocumentPartitionerExtension
e
- the event describing the document changenull
protected TypedPosition findClosestPosition(int offset)
offset
- the offset for which to search the closest positionpublic String getContentType(int offset)
IDocumentPartitioner
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);
getContentType
in interface IDocumentPartitioner
offset
- the offset in the connected documentpublic ITypedRegion getPartition(int offset)
IDocumentPartitioner
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);
getPartition
in interface IDocumentPartitioner
offset
- the offset for which to determine the partitionpublic ITypedRegion[] computePartitioning(int offset, int length)
IDocumentPartitioner
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);
computePartitioning
in interface IDocumentPartitioner
offset
- the offset of the range of interestlength
- the length of the range of interestpublic String[] getLegalContentTypes()
IDocumentPartitioner
getLegalContentTypes
in interface IDocumentPartitioner
protected boolean isSupportedContentType(String contentType)
contentType
- the content type to checktrue
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 determinedpublic String getContentType(int offset, boolean preferOpenPartitions)
IDocumentPartitionerExtension2
If preferOpenPartitions
is true
,
precedence is given to an open partition ending at offset
over a delimited partition starting at offset
.
This method replaces IDocumentPartitioner.getContentType(int)
and
behaves like it when prepreferOpenPartitions
is
false
, i.e. precedence is always given to the partition
that does not end at offset
.
getContentType
in interface IDocumentPartitionerExtension2
offset
- the offset in the connected documentpreferOpenPartitions
- true
if precedence should be
given to a open partition ending at offset
over
a delimited partition starting at offset
public ITypedRegion getPartition(int offset, boolean preferOpenPartitions)
IDocumentPartitionerExtension2
If preferOpenPartitions
is true
,
precedence is given to an open partition ending at offset
over a delimited partition starting at offset
.
This method replaces IDocumentPartitioner.getPartition(int)
and
behaves like it when false
, i.e. precedence is always given to the partition that does not
end at offset
.
getPartition
in interface IDocumentPartitionerExtension2
offset
- the offset for which to determine the partitionpreferOpenPartitions
- true
if precedence should be
given to a open partition ending at offset
over
a delimited partition starting at offset
public ITypedRegion[] computePartitioning(int offset, int length, boolean includeZeroLengthPartitions)
IDocumentPartitionerExtension2
If includeZeroLengthPartitions
is true
, a
zero-length partition of an open partition type (usually the default
partition) is included between two delimited partitions. If it is
false
, no zero-length partitions are included.
This method replaces
IDocumentPartitioner.computePartitioning(int, int)
and behaves
like it when includeZeroLengthPartitions
is
false
.
computePartitioning
in interface IDocumentPartitionerExtension2
offset
- the offset of the range of interestlength
- the length of the range of interestincludeZeroLengthPartitions
- true
if zero-length
partitions should be returned as part of the computed
partitioningpublic void startRewriteSession(DocumentRewriteSession session) throws IllegalStateException
IDocumentPartitionerExtension3
startRewriteSession
in interface IDocumentPartitionerExtension3
session
- the rewrite sessionIllegalStateException
- in case there is already an active rewrite sessionpublic void stopRewriteSession(DocumentRewriteSession session)
IDocumentPartitionerExtension3
startRewriteSession
has
been called before.stopRewriteSession
in interface IDocumentPartitionerExtension3
session
- the rewrite sessionpublic DocumentRewriteSession getActiveRewriteSession()
IDocumentPartitionerExtension3
null
.getActiveRewriteSession
in interface IDocumentPartitionerExtension3
null
protected final void flushRewriteSession()
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.