public class DocumentPartitioner extends Object implements org.eclipse.jface.text.IDocumentPartitioner, org.eclipse.jface.text.IDocumentPartitionerExtension, org.eclipse.jface.text.IDocumentPartitionerExtension2, org.eclipse.jface.text.IDocumentPartitionerExtension3
FastPartitioner in order to be able to fix
documentChanged2(DocumentEvent)| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
CHECK_CACHE_CONSISTENCY
Debug option for cache consistency checking.
|
protected static String |
CONTENT_TYPES_CATEGORY
The position category this partitioner uses to store the document's partitioning information.
|
protected org.eclipse.jface.text.DocumentRewriteSession |
fActiveRewriteSession
The active document rewrite session.
|
protected org.eclipse.jface.text.Position[] |
fCachedPositions
The cached positions from our document, so we don't create a new array every time someone requests partition
information.
|
protected int |
fDeleteOffset
The offset at which a partition has been deleted
|
protected org.eclipse.jface.text.IDocument |
fDocument
The partitioner's document
|
protected int |
fEndOffset
The offset at which the last changed partition ends
|
protected boolean |
fIsInitialized
Flag indicating whether this partitioner has been initialized.
|
protected String[] |
fLegalContentTypes
The legal content types of this partitioner
|
protected String |
fPositionCategory
The position category this partitioner uses to store the document's partitioning information.
|
protected org.eclipse.jface.text.DefaultPositionUpdater |
fPositionUpdater
The position updater used to for the default updating of partitions
|
protected org.eclipse.jface.text.rules.IPartitionTokenScanner |
fScanner
The partitioner's scanner
|
protected int |
fStartOffset
The offset at which the first changed partition starts
|
| Constructor and Description |
|---|
DocumentPartitioner(org.eclipse.jface.text.rules.IPartitionTokenScanner scanner,
ITokenTypeToPartitionTypeMapper mapper) |
DocumentPartitioner(org.eclipse.jface.text.rules.IPartitionTokenScanner scanner,
String[] legalContentTypes)
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()
Calls
initialize() if the receiver is not yet initialized. |
protected void |
clearPositionCache()
Clears the position cache.
|
org.eclipse.jface.text.ITypedRegion[] |
computePartitioning(int offset,
int length) |
org.eclipse.jface.text.ITypedRegion[] |
computePartitioning(int offset,
int length,
boolean includeZeroLengthPartitions) |
void |
connect(org.eclipse.jface.text.IDocument document) |
void |
connect(org.eclipse.jface.text.IDocument document,
boolean delayInitialization) |
void |
disconnect() |
void |
documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent e) |
boolean |
documentChanged(org.eclipse.jface.text.DocumentEvent e) |
org.eclipse.jface.text.IRegion |
documentChanged2(org.eclipse.jface.text.DocumentEvent e) |
protected org.eclipse.jface.text.TypedPosition |
findClosestPosition(int offset)
Returns the position in the partitoner's position category which is close to the given offset.
|
protected void |
flushRewriteSession()
Flushes the active rewrite session.
|
org.eclipse.jface.text.DocumentRewriteSession |
getActiveRewriteSession() |
String |
getContentType(int offset) |
String |
getContentType(int offset,
boolean preferOpenPartitions) |
String[] |
getLegalContentTypes() |
String[] |
getManagingPositionCategories() |
org.eclipse.jface.text.ITypedRegion |
getPartition(int offset) |
org.eclipse.jface.text.ITypedRegion |
getPartition(int offset,
boolean preferOpenPartitions) |
protected org.eclipse.jface.text.Position[] |
getPositions()
Returns the partitioners positions.
|
protected String |
getTokenContentType(org.eclipse.jface.text.rules.IToken token)
Returns a content type encoded in the given token.
|
protected void |
initialize()
Performs the initial partitioning of the partitioner's document.
|
protected boolean |
isSupportedContentType(String contentType)
Returns whether the given type is one of the legal content types.
|
void |
startRewriteSession(org.eclipse.jface.text.DocumentRewriteSession session) |
void |
stopRewriteSession(org.eclipse.jface.text.DocumentRewriteSession session) |
protected static final String CONTENT_TYPES_CATEGORY
protected final org.eclipse.jface.text.rules.IPartitionTokenScanner fScanner
protected final String[] fLegalContentTypes
protected org.eclipse.jface.text.IDocument fDocument
protected final org.eclipse.jface.text.DefaultPositionUpdater fPositionUpdater
protected int fStartOffset
protected int fEndOffset
protected int fDeleteOffset
protected final String fPositionCategory
protected org.eclipse.jface.text.DocumentRewriteSession fActiveRewriteSession
protected boolean fIsInitialized
protected org.eclipse.jface.text.Position[] fCachedPositions
protected static final boolean CHECK_CACHE_CONSISTENCY
public DocumentPartitioner(org.eclipse.jface.text.rules.IPartitionTokenScanner scanner,
String[] legalContentTypes)
scanner - the scanner this partitioner is supposed to uselegalContentTypes - the legal content types of this partitioner@Inject
public DocumentPartitioner(org.eclipse.jface.text.rules.IPartitionTokenScanner scanner,
ITokenTypeToPartitionTypeMapper mapper)
public String[] getManagingPositionCategories()
getManagingPositionCategories in interface org.eclipse.jface.text.IDocumentPartitionerExtension2public final void connect(org.eclipse.jface.text.IDocument document)
connect in interface org.eclipse.jface.text.IDocumentPartitionerpublic void connect(org.eclipse.jface.text.IDocument document,
boolean delayInitialization)
May be extended by subclasses.
connect in interface org.eclipse.jface.text.IDocumentPartitionerExtension3protected final void checkInitialization()
initialize() if the receiver is not yet initialized.protected void initialize()
May be extended by subclasses.
public void disconnect()
May be extended by subclasses.
disconnect in interface org.eclipse.jface.text.IDocumentPartitionerpublic void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent e)
May be extended by subclasses.
documentAboutToBeChanged in interface org.eclipse.jface.text.IDocumentPartitionerpublic final boolean documentChanged(org.eclipse.jface.text.DocumentEvent e)
documentChanged in interface org.eclipse.jface.text.IDocumentPartitionerpublic org.eclipse.jface.text.IRegion documentChanged2(org.eclipse.jface.text.DocumentEvent e)
May be extended by subclasses.
documentChanged2 in interface org.eclipse.jface.text.IDocumentPartitionerExtensionprotected org.eclipse.jface.text.TypedPosition findClosestPosition(int offset)
May be extended or replaced by subclasses.
offset - the offset for which to search the closest positionpublic String getContentType(int offset)
May be replaced or extended by subclasses.
getContentType in interface org.eclipse.jface.text.IDocumentPartitionerpublic org.eclipse.jface.text.ITypedRegion getPartition(int offset)
May be replaced or extended by subclasses.
getPartition in interface org.eclipse.jface.text.IDocumentPartitionerpublic final org.eclipse.jface.text.ITypedRegion[] computePartitioning(int offset,
int length)
computePartitioning in interface org.eclipse.jface.text.IDocumentPartitionerpublic String[] getLegalContentTypes()
May be replaced or extended by subclasses.
getLegalContentTypes in interface org.eclipse.jface.text.IDocumentPartitionerprotected boolean isSupportedContentType(String contentType)
May be extended by subclasses.
contentType - the content type to checktrue if the content type is a legal content typeprotected String getTokenContentType(org.eclipse.jface.text.rules.IToken token)
null and a string it
is assumed that it is the encoded content type.
May be replaced or extended by subclasses.
token - the token whose content type is to be determinedpublic String getContentType(int offset, boolean preferOpenPartitions)
May be replaced or extended by subclasses.
getContentType in interface org.eclipse.jface.text.IDocumentPartitionerExtension2public org.eclipse.jface.text.ITypedRegion getPartition(int offset,
boolean preferOpenPartitions)
May be replaced or extended by subclasses.
getPartition in interface org.eclipse.jface.text.IDocumentPartitionerExtension2public org.eclipse.jface.text.ITypedRegion[] computePartitioning(int offset,
int length,
boolean includeZeroLengthPartitions)
May be replaced or extended by subclasses.
computePartitioning in interface org.eclipse.jface.text.IDocumentPartitionerExtension2public void startRewriteSession(org.eclipse.jface.text.DocumentRewriteSession session)
throws IllegalStateException
startRewriteSession in interface org.eclipse.jface.text.IDocumentPartitionerExtension3IllegalStateExceptionpublic void stopRewriteSession(org.eclipse.jface.text.DocumentRewriteSession session)
May be extended by subclasses.
stopRewriteSession in interface org.eclipse.jface.text.IDocumentPartitionerExtension3public org.eclipse.jface.text.DocumentRewriteSession getActiveRewriteSession()
May be extended by subclasses.
getActiveRewriteSession in interface org.eclipse.jface.text.IDocumentPartitionerExtension3protected final void flushRewriteSession()
protected final void clearPositionCache()
protected final org.eclipse.jface.text.Position[] getPositions()
throws org.eclipse.jface.text.BadPositionCategoryException
org.eclipse.jface.text.BadPositionCategoryException - if getting the positions from the document failsCopyright © 2016. All Rights Reserved.