|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A line tracker maps character positions to line numbers and vice versa. Initially the line tracker is informed about its underlying text which in order to initialize the mapping information. After that, the line tracker is informed about all changes of the underlying text allowing for incremental updates of the mapping information. It is the client's responsibility to actively inform the line tacker about text changes. For example, when using a line tracker in combination with a document the document controls the line tracker.
Clients may implement this interface or use the standard implementation
DefaultLineTracker
.
Method Summary | |
int |
computeNumberOfLines(String text)
Computes the number of lines in the given text. |
String[] |
getLegalLineDelimiters()
Returns the strings this tracker considers as legal line delimiters. |
String |
getLineDelimiter(int line)
Returns the line delimiter of the specified line. |
IRegion |
getLineInformation(int line)
Returns a line description of the given line. |
IRegion |
getLineInformationOfOffset(int offset)
Returns a line description of the line at the given offset. |
int |
getLineLength(int line)
Returns length of the specified line including the line's delimiter. |
int |
getLineNumberOfOffset(int offset)
Returns the line number the character at the given offset belongs to. |
int |
getLineOffset(int line)
Returns the position of the first character of the specified line. |
int |
getNumberOfLines()
Returns the number of lines. |
int |
getNumberOfLines(int offset,
int length)
Returns the number of lines which are occupied by a given text range. |
void |
replace(int offset,
int length,
String text)
Informs the line tracker about the specified change in the tracked text. |
void |
set(String text)
Sets the tracked text to the specified text. |
Method Detail |
public String[] getLegalLineDelimiters()
public String getLineDelimiter(int line) throws BadLocationException
line
- the line whose line delimiter is queried
null
if line does not have a delimiter
BadLocationException
- if the line number is invalid in this tracker's line structurepublic int computeNumberOfLines(String text)
text
- the text whose number of lines should be computed
public int getNumberOfLines()
public int getNumberOfLines(int offset, int length) throws BadLocationException
offset
- the offset of the specified text rangelength
- the length of the specified text range
BadLocationException
- if specified range is unknown to this trackerpublic int getLineOffset(int line) throws BadLocationException
line
- the line of interest
BadLocationException
- if the line is unknown to this trackerpublic int getLineLength(int line) throws BadLocationException
line
- the line of interest
BadLocationException
- if line is unknown to this trackerpublic int getLineNumberOfOffset(int offset) throws BadLocationException
offset
- the offset whose line number to be determined
BadLocationException
- if the offset is invalid in this trackerpublic IRegion getLineInformationOfOffset(int offset) throws BadLocationException
offset
- the offset whose line should be described
BadLocationException
- if offset is invalid in this trackerpublic IRegion getLineInformation(int line) throws BadLocationException
line
- the line that should be described
BadLocationException
- if line is unknown to this trackerpublic void replace(int offset, int length, String text) throws BadLocationException
offset
- the offset of the replaced textlength
- the length of the replaced texttext
- the substitution text
BadLocationException
- if specified range is unknown to this trackerpublic void set(String text)
text
- the new tracked text
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |