org.eclipse.xtext.ui.codetemplates.ui.contentassist
Class DummyDocument

java.lang.Object
  extended by org.eclipse.xtext.ui.codetemplates.ui.contentassist.DummyDocument
All Implemented Interfaces:
org.eclipse.jface.text.IDocument

public class DummyDocument
extends java.lang.Object
implements org.eclipse.jface.text.IDocument

Author:
Sebastian Zarnekow - Initial contribution and API

Field Summary
 
Fields inherited from interface org.eclipse.jface.text.IDocument
DEFAULT_CATEGORY, DEFAULT_CONTENT_TYPE
 
Constructor Summary
DummyDocument(java.lang.String content)
           
 
Method Summary
 void addDocumentListener(org.eclipse.jface.text.IDocumentListener listener)
          Registers the document listener with the document.
 void addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener listener)
          Registers the document partitioning listener with the document.
 void addPosition(org.eclipse.jface.text.Position position)
          Adds the position to the document's default position category.
 void addPosition(java.lang.String category, org.eclipse.jface.text.Position position)
          Adds the position to the specified position category of the document.
 void addPositionCategory(java.lang.String category)
          Adds a new position category to the document.
 void addPositionUpdater(org.eclipse.jface.text.IPositionUpdater updater)
          Appends a new position updater to the document's list of position updaters.
 void addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener documentAdapter)
          Adds the given document listener as one which is notified before those document listeners added with addDocumentListener are notified.
 int computeIndexInCategory(java.lang.String category, int offset)
          Computes the index at which a Position with the specified offset would be inserted into the given category.
 int computeNumberOfLines(java.lang.String text)
          Computes the number of lines in the given text.
 org.eclipse.jface.text.ITypedRegion[] computePartitioning(int offset, int length)
          Computes the partitioning of the given document range using the document's partitioner.
 boolean containsPosition(java.lang.String category, int offset, int length)
          Determines whether a position described by the parameters is managed by this document.
 boolean containsPositionCategory(java.lang.String category)
          Checks the presence of the specified position category.
 java.lang.String get()
          Returns this document's complete text.
 java.lang.String get(int offset, int length)
          Returns this document's text for the specified range.
 char getChar(int offset)
          Returns the character at the given document offset in this document.
 java.lang.String getContentType(int offset)
          Returns the type of the document partition containing the given offset.
 org.eclipse.jface.text.IDocumentPartitioner getDocumentPartitioner()
          Returns this document's partitioner.
 java.lang.String[] getLegalContentTypes()
          Returns the set of legal content types of document partitions.
 java.lang.String[] getLegalLineDelimiters()
          Returns the document's legal line delimiters.
 int getLength()
          Returns the number of characters in this document.
 java.lang.String getLineDelimiter(int line)
          Returns the line delimiter of that line or null if the line is not closed with a line delimiter.
 org.eclipse.jface.text.IRegion getLineInformation(int line)
          Returns a description of the specified line.
 org.eclipse.jface.text.IRegion getLineInformationOfOffset(int offset)
          Returns a description of the line at the given offset.
 int getLineLength(int line)
          Returns the length of the given line including the line's delimiter.
 int getLineOffset(int line)
          Determines the offset of the first character of the given line.
 int getLineOfOffset(int offset)
          Returns the number of the line at which the character of the specified position is located.
 int getNumberOfLines()
          Returns the number of lines in this document
 int getNumberOfLines(int offset, int length)
          Returns the number of lines which are occupied by a given text range.
 org.eclipse.jface.text.ITypedRegion getPartition(int offset)
          Returns the document partition in which the position is located.
 java.lang.String[] getPositionCategories()
          Returns all position categories of this document.
 org.eclipse.jface.text.Position[] getPositions(java.lang.String category)
          Returns all positions of the given position category.
 org.eclipse.jface.text.IPositionUpdater[] getPositionUpdaters()
          Returns the list of position updaters attached to the document.
 void insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater updater, int index)
          Inserts the position updater at the specified index in the document's list of position updaters.
 void removeDocumentListener(org.eclipse.jface.text.IDocumentListener listener)
          Removes the listener from the document's list of document listeners.
 void removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener listener)
          Removes the listener from this document's list of document partitioning listeners.
 void removePosition(org.eclipse.jface.text.Position position)
          Removes the given position from the document's default position category.
 void removePosition(java.lang.String category, org.eclipse.jface.text.Position position)
          Removes the given position from the specified position category.
 void removePositionCategory(java.lang.String category)
          Deletes the position category from the document.
 void removePositionUpdater(org.eclipse.jface.text.IPositionUpdater updater)
          Removes the position updater from the document's list of position updaters.
 void removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener documentAdapter)
          Removes the given document listener from the document's list of pre-notified document listeners.
 void replace(int offset, int length, java.lang.String text)
          Substitutes the given text for the specified document range.
 int search(int startOffset, java.lang.String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord)
          Deprecated. 
 void set(java.lang.String text)
          Replaces the content of the document with the given text.
 void setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner partitioner)
          Sets this document's partitioner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyDocument

public DummyDocument(java.lang.String content)
Method Detail

getChar

public char getChar(int offset)
             throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the character at the given document offset in this document.

Specified by:
getChar in interface org.eclipse.jface.text.IDocument
Parameters:
offset - a document offset
Returns:
the character at the offset
Throws:
org.eclipse.jface.text.BadLocationException - if the offset is invalid in this document

getLength

public int getLength()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the number of characters in this document.

Specified by:
getLength in interface org.eclipse.jface.text.IDocument
Returns:
the number of characters in this document

get

public java.lang.String get()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns this document's complete text.

Specified by:
get in interface org.eclipse.jface.text.IDocument
Returns:
the document's complete text

get

public java.lang.String get(int offset,
                            int length)
                     throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns this document's text for the specified range.

Specified by:
get in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the document offset
length - the length of the specified range
Returns:
the document's text for the specified range
Throws:
org.eclipse.jface.text.BadLocationException - if the range is invalid in this document

set

public void set(java.lang.String text)
Description copied from interface: org.eclipse.jface.text.IDocument
Replaces the content of the document with the given text. Sends a DocumentEvent to all registered IDocumentListener. This method is a convenience method for replace(0, getLength(), text).

Specified by:
set in interface org.eclipse.jface.text.IDocument
Parameters:
text - the new content of the document
See Also:
DocumentEvent, IDocumentListener

replace

public void replace(int offset,
                    int length,
                    java.lang.String text)
             throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Substitutes the given text for the specified document range. Sends a DocumentEvent to all registered IDocumentListener.

Specified by:
replace in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the document offset
length - the length of the specified range
text - the substitution text
Throws:
org.eclipse.jface.text.BadLocationException - if the offset is invalid in this document
See Also:
DocumentEvent, IDocumentListener

addDocumentListener

public void addDocumentListener(org.eclipse.jface.text.IDocumentListener listener)
Description copied from interface: org.eclipse.jface.text.IDocument
Registers the document listener with the document. After registration the IDocumentListener is informed about each change of this document. If the listener is already registered nothing happens.

An IDocumentListener may call back to this method when being inside a document notification.

Specified by:
addDocumentListener in interface org.eclipse.jface.text.IDocument
Parameters:
listener - the listener to be registered

removeDocumentListener

public void removeDocumentListener(org.eclipse.jface.text.IDocumentListener listener)
Description copied from interface: org.eclipse.jface.text.IDocument
Removes the listener from the document's list of document listeners. If the listener is not registered with the document nothing happens.

An IDocumentListener may call back to this method when being inside a document notification.

Specified by:
removeDocumentListener in interface org.eclipse.jface.text.IDocument
Parameters:
listener - the listener to be removed

addPrenotifiedDocumentListener

public void addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener documentAdapter)
Description copied from interface: org.eclipse.jface.text.IDocument
Adds the given document listener as one which is notified before those document listeners added with addDocumentListener are notified. If the given listener is also registered using addDocumentListener it will be notified twice. If the listener is already registered nothing happens.

This method is not for public use.

Specified by:
addPrenotifiedDocumentListener in interface org.eclipse.jface.text.IDocument
Parameters:
documentAdapter - the listener to be added as pre-notified document listener
See Also:
IDocument.removePrenotifiedDocumentListener(IDocumentListener)

removePrenotifiedDocumentListener

public void removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener documentAdapter)
Description copied from interface: org.eclipse.jface.text.IDocument
Removes the given document listener from the document's list of pre-notified document listeners. If the listener is not registered with the document nothing happens.

This method is not for public use.

Specified by:
removePrenotifiedDocumentListener in interface org.eclipse.jface.text.IDocument
Parameters:
documentAdapter - the listener to be removed
See Also:
IDocument.addPrenotifiedDocumentListener(IDocumentListener)

addPositionCategory

public void addPositionCategory(java.lang.String category)
Description copied from interface: org.eclipse.jface.text.IDocument
Adds a new position category to the document. If the position category already exists nothing happens.

Specified by:
addPositionCategory in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category to be added

removePositionCategory

public void removePositionCategory(java.lang.String category)
                            throws org.eclipse.jface.text.BadPositionCategoryException
Description copied from interface: org.eclipse.jface.text.IDocument
Deletes the position category from the document. All positions in this category are thus deleted as well.

Specified by:
removePositionCategory in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category to be removed
Throws:
org.eclipse.jface.text.BadPositionCategoryException - if category is undefined in this document

getPositionCategories

public java.lang.String[] getPositionCategories()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns all position categories of this document. This includes the default position category.

Specified by:
getPositionCategories in interface org.eclipse.jface.text.IDocument
Returns:
the document's position categories

containsPositionCategory

public boolean containsPositionCategory(java.lang.String category)
Description copied from interface: org.eclipse.jface.text.IDocument
Checks the presence of the specified position category.

Specified by:
containsPositionCategory in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category to check
Returns:
true if category is defined

addPosition

public void addPosition(org.eclipse.jface.text.Position position)
                 throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Adds the position to the document's default position category. This is a convenience method for addPosition(DEFAULT_CATEGORY, position).

Specified by:
addPosition in interface org.eclipse.jface.text.IDocument
Parameters:
position - the position to be added
Throws:
org.eclipse.jface.text.BadLocationException - if position describes an invalid range in this document

removePosition

public void removePosition(org.eclipse.jface.text.Position position)
Description copied from interface: org.eclipse.jface.text.IDocument
Removes the given position from the document's default position category. This is a convenience method for removePosition(DEFAULT_CATEGORY, position).

Specified by:
removePosition in interface org.eclipse.jface.text.IDocument
Parameters:
position - the position to be removed

addPosition

public void addPosition(java.lang.String category,
                        org.eclipse.jface.text.Position position)
                 throws org.eclipse.jface.text.BadLocationException,
                        org.eclipse.jface.text.BadPositionCategoryException
Description copied from interface: org.eclipse.jface.text.IDocument
Adds the position to the specified position category of the document. Positions may be added multiple times. The order of the category is maintained.

Note: The position is only updated on each change applied to the document if a IPositionUpdater has been registered that handles the given category.

Specified by:
addPosition in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category to which to add
position - the position to be added
Throws:
org.eclipse.jface.text.BadLocationException - if position describes an invalid range in this document
org.eclipse.jface.text.BadPositionCategoryException - if the category is undefined in this document

removePosition

public void removePosition(java.lang.String category,
                           org.eclipse.jface.text.Position position)
                    throws org.eclipse.jface.text.BadPositionCategoryException
Description copied from interface: org.eclipse.jface.text.IDocument
Removes the given position from the specified position category. If the position is not part of the specified category nothing happens. If the position has been added multiple times, only the first occurrence is deleted.

Specified by:
removePosition in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category from which to delete
position - the position to be deleted
Throws:
org.eclipse.jface.text.BadPositionCategoryException - if category is undefined in this document

getPositions

public org.eclipse.jface.text.Position[] getPositions(java.lang.String category)
                                               throws org.eclipse.jface.text.BadPositionCategoryException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns all positions of the given position category. The positions are ordered according to the category's order. Manipulating this list does not affect the document, but manipulating the position does affect the document.

Specified by:
getPositions in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category
Returns:
the list of all positions
Throws:
org.eclipse.jface.text.BadPositionCategoryException - if category is undefined in this document

containsPosition

public boolean containsPosition(java.lang.String category,
                                int offset,
                                int length)
Description copied from interface: org.eclipse.jface.text.IDocument
Determines whether a position described by the parameters is managed by this document.

Specified by:
containsPosition in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category to check
offset - the offset of the position to find
length - the length of the position to find
Returns:
true if position is found

computeIndexInCategory

public int computeIndexInCategory(java.lang.String category,
                                  int offset)
                           throws org.eclipse.jface.text.BadLocationException,
                                  org.eclipse.jface.text.BadPositionCategoryException
Description copied from interface: org.eclipse.jface.text.IDocument
Computes the index at which a Position with the specified offset would be inserted into the given category. As the ordering inside a category only depends on the offset, the index must be chosen to be the first of all positions with the same offset.

Specified by:
computeIndexInCategory in interface org.eclipse.jface.text.IDocument
Parameters:
category - the category in which would be added
offset - the position offset to be considered
Returns:
the index into the category
Throws:
org.eclipse.jface.text.BadLocationException - if offset is invalid in this document
org.eclipse.jface.text.BadPositionCategoryException - if category is undefined in this document

addPositionUpdater

public void addPositionUpdater(org.eclipse.jface.text.IPositionUpdater updater)
Description copied from interface: org.eclipse.jface.text.IDocument
Appends a new position updater to the document's list of position updaters. Position updaters may be added multiple times.

An IPositionUpdater may call back to this method when being inside a document notification.

Specified by:
addPositionUpdater in interface org.eclipse.jface.text.IDocument
Parameters:
updater - the updater to be added

removePositionUpdater

public void removePositionUpdater(org.eclipse.jface.text.IPositionUpdater updater)
Description copied from interface: org.eclipse.jface.text.IDocument
Removes the position updater from the document's list of position updaters. If the position updater has multiple occurrences only the first occurrence is removed. If the position updater is not registered with this document, nothing happens.

An IPositionUpdater may call back to this method when being inside a document notification.

Specified by:
removePositionUpdater in interface org.eclipse.jface.text.IDocument
Parameters:
updater - the updater to be removed

insertPositionUpdater

public void insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater updater,
                                  int index)
Description copied from interface: org.eclipse.jface.text.IDocument
Inserts the position updater at the specified index in the document's list of position updaters. Positions updaters may be inserted multiple times.

An IPositionUpdater may call back to this method when being inside a document notification.

Specified by:
insertPositionUpdater in interface org.eclipse.jface.text.IDocument
Parameters:
updater - the updater to be inserted
index - the index in the document's updater list

getPositionUpdaters

public org.eclipse.jface.text.IPositionUpdater[] getPositionUpdaters()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the list of position updaters attached to the document.

Specified by:
getPositionUpdaters in interface org.eclipse.jface.text.IDocument
Returns:
the list of position updaters

getLegalContentTypes

public java.lang.String[] getLegalContentTypes()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the set of legal content types of document partitions. This set can be empty. The set can contain more content types than contained by the result of getPartitioning(0, getLength()).

Use IDocumentExtension3.getLegalContentTypes(String) when the document supports multiple partitionings. In that case this method is equivalent to:

    IDocumentExtension3 extension= (IDocumentExtension3) document;
    return extension.getLegalContentTypes(IDocumentExtension3.DEFAULT_PARTITIONING);
 

Specified by:
getLegalContentTypes in interface org.eclipse.jface.text.IDocument
Returns:
the set of legal content types

getContentType

public java.lang.String getContentType(int offset)
                                throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the type of the document partition containing the given offset. This is a convenience method for getPartition(offset).getType().

Use IDocumentExtension3.getContentType(String, int, boolean) when the document supports multiple partitionings. In that case this method is equivalent to:

    IDocumentExtension3 extension= (IDocumentExtension3) document;
    return extension.getContentType(IDocumentExtension3.DEFAULT_PARTITIONING, offset, false);
 

Specified by:
getContentType in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the document offset
Returns:
the partition type
Throws:
org.eclipse.jface.text.BadLocationException - if offset is invalid in this document

getPartition

public org.eclipse.jface.text.ITypedRegion getPartition(int offset)
                                                 throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the document partition in which the position is located.

Use IDocumentExtension3.getPartition(String, int, boolean) when the document supports multiple partitionings. In that case this method is equivalent:

    IDocumentExtension3 extension= (IDocumentExtension3) document;
    return extension.getPartition(IDocumentExtension3.DEFAULT_PARTITIONING, offset, false);
 

Specified by:
getPartition in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the document offset
Returns:
a specification of the partition
Throws:
org.eclipse.jface.text.BadLocationException - if offset is invalid in this document

computePartitioning

public org.eclipse.jface.text.ITypedRegion[] computePartitioning(int offset,
                                                                 int length)
                                                          throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Computes the partitioning of the given document range using the document's partitioner.

Use IDocumentExtension3.computePartitioning(String, int, int, boolean) when the document supports multiple partitionings. In that case this method is equivalent:

    IDocumentExtension3 extension= (IDocumentExtension3) document;
    return extension.computePartitioning(IDocumentExtension3.DEFAULT_PARTITIONING, offset, length, false);
 

Specified by:
computePartitioning in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the document offset at which the range starts
length - the length of the document range
Returns:
a specification of the range's partitioning
Throws:
org.eclipse.jface.text.BadLocationException - if the range is invalid in this document

addDocumentPartitioningListener

public void addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener listener)
Description copied from interface: org.eclipse.jface.text.IDocument
Registers the document partitioning listener with the document. After registration the document partitioning listener is informed about each partition change cause by a document manipulation or by changing the document's partitioner. If a document partitioning listener is also a document listener, the following notification sequence is guaranteed if a document manipulation changes the document partitioning: If the listener is already registered nothing happens.

An IDocumentPartitioningListener may call back to this method when being inside a document notification.

Specified by:
addDocumentPartitioningListener in interface org.eclipse.jface.text.IDocument
Parameters:
listener - the listener to be added

removeDocumentPartitioningListener

public void removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener listener)
Description copied from interface: org.eclipse.jface.text.IDocument
Removes the listener from this document's list of document partitioning listeners. If the listener is not registered with the document nothing happens.

An IDocumentPartitioningListener may call back to this method when being inside a document notification.

Specified by:
removeDocumentPartitioningListener in interface org.eclipse.jface.text.IDocument
Parameters:
listener - the listener to be removed

setDocumentPartitioner

public void setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner partitioner)
Description copied from interface: org.eclipse.jface.text.IDocument
Sets this document's partitioner. The caller of this method is responsible for disconnecting the document's old partitioner from the document and to connect the new partitioner to the document. Informs all document partitioning listeners about this change.

Use IDocumentExtension3.setDocumentPartitioner(String, IDocumentPartitioner) when the document supports multiple partitionings. In that case this method is equivalent to:

    IDocumentExtension3 extension= (IDocumentExtension3) document;
    extension.setDocumentPartitioner(IDocumentExtension3.DEFAULT_PARTITIONING, partitioner);
 

Specified by:
setDocumentPartitioner in interface org.eclipse.jface.text.IDocument
Parameters:
partitioner - the document's new partitioner
See Also:
IDocumentPartitioningListener

getDocumentPartitioner

public org.eclipse.jface.text.IDocumentPartitioner getDocumentPartitioner()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns this document's partitioner.

Use IDocumentExtension3.getDocumentPartitioner(String) when the document supports multiple partitionings. In that case this method is equivalent to:

    IDocumentExtension3 extension= (IDocumentExtension3) document;
    return extension.getDocumentPartitioner(IDocumentExtension3.DEFAULT_PARTITIONING);
 

Specified by:
getDocumentPartitioner in interface org.eclipse.jface.text.IDocument
Returns:
this document's partitioner

getLineLength

public int getLineLength(int line)
                  throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the length of the given line including the line's delimiter.

Specified by:
getLineLength in interface org.eclipse.jface.text.IDocument
Parameters:
line - the line of interest
Returns:
the length of the line
Throws:
org.eclipse.jface.text.BadLocationException - if the line number is invalid in this document

getLineOfOffset

public int getLineOfOffset(int offset)
                    throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the number of the line at which the character of the specified position is located. The first line has the line number 0. A new line starts directly after a line delimiter. (offset == document length) is a valid argument although there is no corresponding character.

Specified by:
getLineOfOffset in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the document offset
Returns:
the number of the line
Throws:
org.eclipse.jface.text.BadLocationException - if the offset is invalid in this document

getLineOffset

public int getLineOffset(int line)
                  throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Determines the offset of the first character of the given line.

Specified by:
getLineOffset in interface org.eclipse.jface.text.IDocument
Parameters:
line - the line of interest
Returns:
the document offset
Throws:
org.eclipse.jface.text.BadLocationException - if the line number is invalid in this document

getLineInformation

public org.eclipse.jface.text.IRegion getLineInformation(int line)
                                                  throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns a description of the specified line. The line is described by its offset and its length excluding the line's delimiter.

Specified by:
getLineInformation in interface org.eclipse.jface.text.IDocument
Parameters:
line - the line of interest
Returns:
a line description
Throws:
org.eclipse.jface.text.BadLocationException - if the line number is invalid in this document

getLineInformationOfOffset

public org.eclipse.jface.text.IRegion getLineInformationOfOffset(int offset)
                                                          throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns a description of the line at the given offset. The description contains the offset and the length of the line excluding the line's delimiter.

Specified by:
getLineInformationOfOffset in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the offset whose line should be described
Returns:
a region describing the line
Throws:
org.eclipse.jface.text.BadLocationException - if offset is invalid in this document

getNumberOfLines

public int getNumberOfLines()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the number of lines in this document

Specified by:
getNumberOfLines in interface org.eclipse.jface.text.IDocument
Returns:
the number of lines in this document

getNumberOfLines

public int getNumberOfLines(int offset,
                            int length)
                     throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the number of lines which are occupied by a given text range.

Specified by:
getNumberOfLines in interface org.eclipse.jface.text.IDocument
Parameters:
offset - the offset of the specified text range
length - the length of the specified text range
Returns:
the number of lines occupied by the specified range
Throws:
org.eclipse.jface.text.BadLocationException - if specified range is invalid in this tracker

computeNumberOfLines

public int computeNumberOfLines(java.lang.String text)
Description copied from interface: org.eclipse.jface.text.IDocument
Computes the number of lines in the given text. For a given implementer of this interface this method returns the same result as set(text); getNumberOfLines().

Specified by:
computeNumberOfLines in interface org.eclipse.jface.text.IDocument
Parameters:
text - the text whose number of lines should be computed
Returns:
the number of lines in the given text

getLegalLineDelimiters

public java.lang.String[] getLegalLineDelimiters()
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the document's legal line delimiters.

Specified by:
getLegalLineDelimiters in interface org.eclipse.jface.text.IDocument
Returns:
the document's legal line delimiters

getLineDelimiter

public java.lang.String getLineDelimiter(int line)
                                  throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.IDocument
Returns the line delimiter of that line or null if the line is not closed with a line delimiter.

Specified by:
getLineDelimiter in interface org.eclipse.jface.text.IDocument
Parameters:
line - the line of interest
Returns:
the line's delimiter or null if line does not have a delimiter
Throws:
org.eclipse.jface.text.BadLocationException - if the line number is invalid in this document

search

@Deprecated
public int search(int startOffset,
                             java.lang.String findString,
                             boolean forwardSearch,
                             boolean caseSensitive,
                             boolean wholeWord)
           throws org.eclipse.jface.text.BadLocationException
Deprecated. 

Description copied from interface: org.eclipse.jface.text.IDocument
Returns the offset of a given search string in the document based on a set of search criteria.

Specified by:
search in interface org.eclipse.jface.text.IDocument
Parameters:
startOffset - document offset at which search starts
findString - the string to find
forwardSearch - the search direction
caseSensitive - indicates whether lower and upper case should be distinguished
wholeWord - indicates whether the findString should be limited by white spaces as defined by Character.isWhiteSpace
Returns:
the offset of the first occurrence of findString based on the parameters or -1 if no match is found
Throws:
org.eclipse.jface.text.BadLocationException - if startOffset is an invalid document offset