Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Platform
Release 3.5

Class Document

  extended by 

      extended by 
All Implemented Interfaces:
IDocument, IDocumentExtension, IDocumentExtension2, IDocumentExtension3, IDocumentExtension4, IRepairableDocument, IRepairableDocumentExtension

public class Document
extends AbstractDocument

Default document implementation. Uses a GapTextStore wrapped inside a CopyOnWriteTextStore as text store.

The used line tracker considers the following strings as line delimiters: "\n", "\r", "\r\n".

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.

See Also:
GapTextStore, CopyOnWriteTextStore

Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jface.text. IDocumentExtension
Field Summary
Fields inherited from interface org.eclipse.jface.text. IDocument
Fields inherited from interface org.eclipse.jface.text. IDocumentExtension3
Fields inherited from interface org.eclipse.jface.text. IDocumentExtension4
Constructor Summary
Document ()
          Creates a new empty document.
Document ( String initialContent)
          Creates a new document with the given initial content.
Method Summary
 boolean isLineInformationRepairNeeded (int offset, int length, String text)
          Tells whether the line information of the document implementing this interface needs to be repaired.
Methods inherited from class org.eclipse.jface.text. AbstractDocument
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, updatePositions
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Document()
Creates a new empty document.


public Document(
String initialContent)
Creates a new document with the given initial content.

initialContent - the document's initial content
Method Detail


public boolean isLineInformationRepairNeeded(int offset,
                                             int length,
String text)
Description copied from class: AbstractDocument
Tells whether the line information of the document implementing this interface needs to be repaired.

Specified by:
isLineInformationRepairNeeded in interface IRepairableDocumentExtension
isLineInformationRepairNeeded in class AbstractDocument
offset - the document offset
length - the length of the specified range
text - the substitution text to check
true if the line information must be repaired
BadLocationException - if the offset is invalid in this document
See Also:

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire