public interface ILineTracker
In order to provide backward compatibility for clients of ILineTracker
, extension
interfaces are used to provide a means of evolution. The following extension interfaces
exist:
ILineTrackerExtension
since version 3.1 introducing the concept
of rewrite sessions.Clients may implement this interface or use the standard implementation
DefaultLineTracker
or
ConfigurableLineTracker
.Modifier and Type | Method and Description |
---|---|
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.
|
String[] getLegalLineDelimiters()
String getLineDelimiter(int line) throws BadLocationException
null
if the
line is not closed with a line delimiter.line
- the line whose line delimiter is queriednull
if line does not have a delimiterBadLocationException
- if the line number is invalid in this tracker's line structureint computeNumberOfLines(String text)
text
- the text whose number of lines should be computedint getNumberOfLines()
Note that a document always has at least one line.
int getNumberOfLines(int offset, int length) throws BadLocationException
offset
- the offset of the specified text rangelength
- the length of the specified text rangeBadLocationException
- if specified range is unknown to this trackerint getLineOffset(int line) throws BadLocationException
line
- the line of interestBadLocationException
- if the line is unknown to this trackerint getLineLength(int line) throws BadLocationException
line
- the line of interestBadLocationException
- if line is unknown to this trackerint getLineNumberOfOffset(int offset) throws BadLocationException
offset
- the offset whose line number to be determinedBadLocationException
- if the offset is invalid in this trackerIRegion getLineInformationOfOffset(int offset) throws BadLocationException
offset
- the offset whose line should be describedBadLocationException
- if offset is invalid in this trackerIRegion getLineInformation(int line) throws BadLocationException
line
- the line that should be describedBadLocationException
- if line is unknown to this trackervoid replace(int offset, int length, String text) throws BadLocationException
offset
- the offset of the replaced textlength
- the length of the replaced texttext
- the substitution textBadLocationException
- if specified range is unknown to this trackervoid set(String text)
text
- the new tracked text
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.