public class Document extends AbstractDocument
GapTextStore wrapped
inside a CopyOnWriteTextStore as text store.
The used line tracker considers the following strings as line delimiters: "\n", "\r", "\r\n". In
case of a text replacement across line delimiter boundaries and with different line delimiters,
the line tracker might have to be repaired. Use
isLineInformationRepairNeeded(int, int, String) before doing the text replace if you
have the need to discover such a situation.
The document is ready to use. It has a default position category for which a default position updater is installed.
Performance: The implementation should perform reasonably well for typical
source code documents. It is not designed for very large documents of a size of several
megabytes. Space-saving implementations are initially used for both the text store and the line
tracker; the first modification after a set incurs the cost to transform the
document structures to efficiently handle updates.
See GapTextStore and TreeLineTracker for algorithmic behavior of the used
document structures.
GapTextStore,
CopyOnWriteTextStoreIDocumentExtension.IReplaceDEFAULT_CATEGORY, DEFAULT_CONTENT_TYPEDEFAULT_PARTITIONINGUNKNOWN_MODIFICATION_STAMP| Constructor and Description |
|---|
Document()
Creates a new empty document.
|
Document(String initialContent)
Creates a new document with the given initial content.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLineInformationRepairNeeded(int offset,
int length,
String text)
Tells whether the line information of the document implementing this interface needs to be
repaired after replacing the given text.
|
acceptPostNotificationReplaces, addDocumentListener, addDocumentPartitioningListener, addDocumentRewriteSessionListener, addPosition, addPosition, addPositionCategory, addPositionUpdater, addPrenotifiedDocumentListener, checkStateOfPartitioner, completeInitialization, computeIndexInCategory, computeIndexInPositionList, computeIndexInPositionList, computeNumberOfLines, computePartitioning, computePartitioning, containsPosition, containsPositionCategory, doFireDocumentChanged, doFireDocumentChanged, doFireDocumentChanged2, fireDocumentAboutToBeChanged, fireDocumentChanged, fireDocumentPartitioningChanged, fireDocumentPartitioningChanged, fireDocumentPartitioningChanged, fireRewriteSessionChanged, get, get, getActiveRewriteSession, getChar, getContentType, getContentType, getDefaultLineDelimiter, getDocumentListeners, getDocumentManagedPositions, getDocumentPartitioner, getDocumentPartitioner, getDocumentPartitioningListeners, getLegalContentTypes, getLegalContentTypes, getLegalLineDelimiters, getLength, getLineDelimiter, getLineInformation, getLineInformationOfOffset, getLineLength, getLineOffset, getLineOfOffset, getModificationStamp, getNumberOfLines, getNumberOfLines, getPartition, getPartition, getPartitionings, getPositionCategories, getPositions, getPositions, getPositionUpdaters, getStore, getTracker, ignorePostNotificationReplaces, insertPositionUpdater, registerPostNotificationReplace, removeDocumentListener, removeDocumentPartitioningListener, removeDocumentRewriteSessionListener, removePosition, removePosition, removePositionCategory, removePositionUpdater, removePrenotifiedDocumentListener, repairLineInformation, replace, replace, resumeListenerNotification, resumePostNotificationProcessing, search, set, set, setDocumentPartitioner, setDocumentPartitioner, setInitialLineDelimiter, setLineTracker, setTextStore, startRewriteSession, startRewriteSessionOnPartitioners, startSequentialRewrite, stopListenerNotification, stopPostNotificationProcessing, stopRewriteSession, stopRewriteSessionOnPartitioners, stopSequentialRewrite, updateDocumentStructures, updatePositionspublic Document()
public Document(String initialContent)
initialContent - the document's initial contentpublic boolean isLineInformationRepairNeeded(int offset,
int length,
String text)
throws BadLocationException
AbstractDocumentisLineInformationRepairNeeded in interface IRepairableDocumentExtensionisLineInformationRepairNeeded in class AbstractDocumentoffset - the document offsetlength - the length of the specified rangetext - the substitution text to checktrue if the line information must be repaired after replacingBadLocationException - if the offset is invalid in this documentIRepairableDocument.repairLineInformation()
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.