|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.xtext.ui.codetemplates.ui.contentassist.DummyDocument
public class DummyDocument
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 |
---|
public DummyDocument(java.lang.String content)
Method Detail |
---|
public char getChar(int offset) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
getChar
in interface org.eclipse.jface.text.IDocument
offset
- a document offset
org.eclipse.jface.text.BadLocationException
- if the offset is invalid in this documentpublic int getLength()
org.eclipse.jface.text.IDocument
getLength
in interface org.eclipse.jface.text.IDocument
public java.lang.String get()
org.eclipse.jface.text.IDocument
get
in interface org.eclipse.jface.text.IDocument
public java.lang.String get(int offset, int length) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
get
in interface org.eclipse.jface.text.IDocument
offset
- the document offsetlength
- the length of the specified range
org.eclipse.jface.text.BadLocationException
- if the range is invalid in this documentpublic void set(java.lang.String text)
org.eclipse.jface.text.IDocument
DocumentEvent
to all registered IDocumentListener
.
This method is a convenience method for replace(0, getLength(), text)
.
set
in interface org.eclipse.jface.text.IDocument
text
- the new content of the documentDocumentEvent
,
IDocumentListener
public void replace(int offset, int length, java.lang.String text) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
DocumentEvent
to all registered IDocumentListener
.
replace
in interface org.eclipse.jface.text.IDocument
offset
- the document offsetlength
- the length of the specified rangetext
- the substitution text
org.eclipse.jface.text.BadLocationException
- if the offset is invalid in this documentDocumentEvent
,
IDocumentListener
public void addDocumentListener(org.eclipse.jface.text.IDocumentListener listener)
org.eclipse.jface.text.IDocument
An IDocumentListener
may call back to this method
when being inside a document notification.
addDocumentListener
in interface org.eclipse.jface.text.IDocument
listener
- the listener to be registeredpublic void removeDocumentListener(org.eclipse.jface.text.IDocumentListener listener)
org.eclipse.jface.text.IDocument
An IDocumentListener
may call back to this method
when being inside a document notification.
removeDocumentListener
in interface org.eclipse.jface.text.IDocument
listener
- the listener to be removedpublic void addPrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener documentAdapter)
org.eclipse.jface.text.IDocument
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.
addPrenotifiedDocumentListener
in interface org.eclipse.jface.text.IDocument
documentAdapter
- the listener to be added as pre-notified document listenerIDocument.removePrenotifiedDocumentListener(IDocumentListener)
public void removePrenotifiedDocumentListener(org.eclipse.jface.text.IDocumentListener documentAdapter)
org.eclipse.jface.text.IDocument
This method is not for public use.
removePrenotifiedDocumentListener
in interface org.eclipse.jface.text.IDocument
documentAdapter
- the listener to be removedIDocument.addPrenotifiedDocumentListener(IDocumentListener)
public void addPositionCategory(java.lang.String category)
org.eclipse.jface.text.IDocument
addPositionCategory
in interface org.eclipse.jface.text.IDocument
category
- the category to be addedpublic void removePositionCategory(java.lang.String category) throws org.eclipse.jface.text.BadPositionCategoryException
org.eclipse.jface.text.IDocument
removePositionCategory
in interface org.eclipse.jface.text.IDocument
category
- the category to be removed
org.eclipse.jface.text.BadPositionCategoryException
- if category is undefined in this documentpublic java.lang.String[] getPositionCategories()
org.eclipse.jface.text.IDocument
getPositionCategories
in interface org.eclipse.jface.text.IDocument
public boolean containsPositionCategory(java.lang.String category)
org.eclipse.jface.text.IDocument
containsPositionCategory
in interface org.eclipse.jface.text.IDocument
category
- the category to check
true
if category is definedpublic void addPosition(org.eclipse.jface.text.Position position) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
addPosition(DEFAULT_CATEGORY, position)
.
addPosition
in interface org.eclipse.jface.text.IDocument
position
- the position to be added
org.eclipse.jface.text.BadLocationException
- if position describes an invalid range in this documentpublic void removePosition(org.eclipse.jface.text.Position position)
org.eclipse.jface.text.IDocument
removePosition(DEFAULT_CATEGORY, position)
.
removePosition
in interface org.eclipse.jface.text.IDocument
position
- the position to be removedpublic void addPosition(java.lang.String category, org.eclipse.jface.text.Position position) throws org.eclipse.jface.text.BadLocationException, org.eclipse.jface.text.BadPositionCategoryException
org.eclipse.jface.text.IDocument
Note: The position is only updated on each change
applied to the document if a IPositionUpdater
has been
registered that handles the given category.
addPosition
in interface org.eclipse.jface.text.IDocument
category
- the category to which to addposition
- the position to be added
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 documentpublic void removePosition(java.lang.String category, org.eclipse.jface.text.Position position) throws org.eclipse.jface.text.BadPositionCategoryException
org.eclipse.jface.text.IDocument
removePosition
in interface org.eclipse.jface.text.IDocument
category
- the category from which to deleteposition
- the position to be deleted
org.eclipse.jface.text.BadPositionCategoryException
- if category is undefined in this documentpublic org.eclipse.jface.text.Position[] getPositions(java.lang.String category) throws org.eclipse.jface.text.BadPositionCategoryException
org.eclipse.jface.text.IDocument
getPositions
in interface org.eclipse.jface.text.IDocument
category
- the category
org.eclipse.jface.text.BadPositionCategoryException
- if category is undefined in this documentpublic boolean containsPosition(java.lang.String category, int offset, int length)
org.eclipse.jface.text.IDocument
containsPosition
in interface org.eclipse.jface.text.IDocument
category
- the category to checkoffset
- the offset of the position to findlength
- the length of the position to find
true
if position is foundpublic int computeIndexInCategory(java.lang.String category, int offset) throws org.eclipse.jface.text.BadLocationException, org.eclipse.jface.text.BadPositionCategoryException
org.eclipse.jface.text.IDocument
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.
computeIndexInCategory
in interface org.eclipse.jface.text.IDocument
category
- the category in which would be addedoffset
- the position offset to be considered
org.eclipse.jface.text.BadLocationException
- if offset is invalid in this document
org.eclipse.jface.text.BadPositionCategoryException
- if category is undefined in this documentpublic void addPositionUpdater(org.eclipse.jface.text.IPositionUpdater updater)
org.eclipse.jface.text.IDocument
An IPositionUpdater
may call back to this method
when being inside a document notification.
addPositionUpdater
in interface org.eclipse.jface.text.IDocument
updater
- the updater to be addedpublic void removePositionUpdater(org.eclipse.jface.text.IPositionUpdater updater)
org.eclipse.jface.text.IDocument
An IPositionUpdater
may call back to this method
when being inside a document notification.
removePositionUpdater
in interface org.eclipse.jface.text.IDocument
updater
- the updater to be removedpublic void insertPositionUpdater(org.eclipse.jface.text.IPositionUpdater updater, int index)
org.eclipse.jface.text.IDocument
An IPositionUpdater
may call back to this method
when being inside a document notification.
insertPositionUpdater
in interface org.eclipse.jface.text.IDocument
updater
- the updater to be insertedindex
- the index in the document's updater listpublic org.eclipse.jface.text.IPositionUpdater[] getPositionUpdaters()
org.eclipse.jface.text.IDocument
getPositionUpdaters
in interface org.eclipse.jface.text.IDocument
public java.lang.String[] getLegalContentTypes()
org.eclipse.jface.text.IDocument
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);
getLegalContentTypes
in interface org.eclipse.jface.text.IDocument
public java.lang.String getContentType(int offset) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
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);
getContentType
in interface org.eclipse.jface.text.IDocument
offset
- the document offset
org.eclipse.jface.text.BadLocationException
- if offset is invalid in this documentpublic org.eclipse.jface.text.ITypedRegion getPartition(int offset) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
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);
getPartition
in interface org.eclipse.jface.text.IDocument
offset
- the document offset
org.eclipse.jface.text.BadLocationException
- if offset is invalid in this documentpublic org.eclipse.jface.text.ITypedRegion[] computePartitioning(int offset, int length) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
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);
computePartitioning
in interface org.eclipse.jface.text.IDocument
offset
- the document offset at which the range startslength
- the length of the document range
org.eclipse.jface.text.BadLocationException
- if the range is invalid in this documentpublic void addDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener listener)
org.eclipse.jface.text.IDocument
An IDocumentPartitioningListener
may call back to this method
when being inside a document notification.
addDocumentPartitioningListener
in interface org.eclipse.jface.text.IDocument
listener
- the listener to be addedpublic void removeDocumentPartitioningListener(org.eclipse.jface.text.IDocumentPartitioningListener listener)
org.eclipse.jface.text.IDocument
An IDocumentPartitioningListener
may call back to this method
when being inside a document notification.
removeDocumentPartitioningListener
in interface org.eclipse.jface.text.IDocument
listener
- the listener to be removedpublic void setDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner partitioner)
org.eclipse.jface.text.IDocument
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);
setDocumentPartitioner
in interface org.eclipse.jface.text.IDocument
partitioner
- the document's new partitionerIDocumentPartitioningListener
public org.eclipse.jface.text.IDocumentPartitioner getDocumentPartitioner()
org.eclipse.jface.text.IDocument
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);
getDocumentPartitioner
in interface org.eclipse.jface.text.IDocument
public int getLineLength(int line) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
getLineLength
in interface org.eclipse.jface.text.IDocument
line
- the line of interest
org.eclipse.jface.text.BadLocationException
- if the line number is invalid in this documentpublic int getLineOfOffset(int offset) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
(offset == document length)
is a valid argument although there is no
corresponding character.
getLineOfOffset
in interface org.eclipse.jface.text.IDocument
offset
- the document offset
org.eclipse.jface.text.BadLocationException
- if the offset is invalid in this documentpublic int getLineOffset(int line) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
getLineOffset
in interface org.eclipse.jface.text.IDocument
line
- the line of interest
org.eclipse.jface.text.BadLocationException
- if the line number is invalid in this documentpublic org.eclipse.jface.text.IRegion getLineInformation(int line) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
getLineInformation
in interface org.eclipse.jface.text.IDocument
line
- the line of interest
org.eclipse.jface.text.BadLocationException
- if the line number is invalid in this documentpublic org.eclipse.jface.text.IRegion getLineInformationOfOffset(int offset) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
getLineInformationOfOffset
in interface org.eclipse.jface.text.IDocument
offset
- the offset whose line should be described
org.eclipse.jface.text.BadLocationException
- if offset is invalid in this documentpublic int getNumberOfLines()
org.eclipse.jface.text.IDocument
getNumberOfLines
in interface org.eclipse.jface.text.IDocument
public int getNumberOfLines(int offset, int length) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
getNumberOfLines
in interface org.eclipse.jface.text.IDocument
offset
- the offset of the specified text rangelength
- the length of the specified text range
org.eclipse.jface.text.BadLocationException
- if specified range is invalid in this trackerpublic int computeNumberOfLines(java.lang.String text)
org.eclipse.jface.text.IDocument
set(text); getNumberOfLines()
.
computeNumberOfLines
in interface org.eclipse.jface.text.IDocument
text
- the text whose number of lines should be computed
public java.lang.String[] getLegalLineDelimiters()
org.eclipse.jface.text.IDocument
getLegalLineDelimiters
in interface org.eclipse.jface.text.IDocument
public java.lang.String getLineDelimiter(int line) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
null
if the
line is not closed with a line delimiter.
getLineDelimiter
in interface org.eclipse.jface.text.IDocument
line
- the line of interest
null
if line does not have a delimiter
org.eclipse.jface.text.BadLocationException
- if the line number is invalid in this document@Deprecated public int search(int startOffset, java.lang.String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) throws org.eclipse.jface.text.BadLocationException
org.eclipse.jface.text.IDocument
search
in interface org.eclipse.jface.text.IDocument
startOffset
- document offset at which search startsfindString
- the string to findforwardSearch
- the search directioncaseSensitive
- indicates whether lower and upper case should be distinguishedwholeWord
- indicates whether the findString should be limited by white spaces as
defined by Character.isWhiteSpace
org.eclipse.jface.text.BadLocationException
- if startOffset is an invalid document offset
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |