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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

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

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.text
Interface ILineTracker

All Known Implementing Classes:
AbstractLineTracker, ConfigurableLineTracker, DefaultLineTracker

public interface ILineTracker

A line tracker maps character positions to line numbers and vice versa. Initially the line tracker is informed about its underlying text 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.

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:

Clients may implement this interface or use the standard implementation

DefaultLineTrackeror ConfigurableLineTracker.


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

getLegalLineDelimiters

String[] getLegalLineDelimiters()
Returns the strings this tracker considers as legal line delimiters.

Returns:
the legal line delimiters

getLineDelimiter

String getLineDelimiter(int line)
                        throws 
BadLocationException
Returns the line delimiter of the specified line. Returns null if the line is not closed with a line delimiter.

Parameters:
line - the line whose line delimiter is queried
Returns:
the line's delimiter or null if line does not have a delimiter
Throws:
BadLocationException - if the line number is invalid in this tracker's line structure

computeNumberOfLines

int computeNumberOfLines(
String text)
Computes the number of lines in the given text.

Parameters:
text - the text whose number of lines should be computed
Returns:
the number of lines in the given text

getNumberOfLines

int getNumberOfLines()
Returns the number of lines.

Note that a document always has at least one line.

Returns:
the number of lines in this tracker's line structure

getNumberOfLines

int getNumberOfLines(int offset,
                     int length)
                     throws 
BadLocationException
Returns the number of lines which are occupied by a given text range.

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:
BadLocationException - if specified range is unknown to this tracker

getLineOffset

int getLineOffset(int line)
                  throws 
BadLocationException
Returns the position of the first character of the specified line.

Parameters:
line - the line of interest
Returns:
offset of the first character of the line
Throws:
BadLocationException - if the line is unknown to this tracker

getLineLength

int getLineLength(int line)
                  throws 
BadLocationException
Returns length of the specified line including the line's delimiter.

Parameters:
line - the line of interest
Returns:
the length of the line
Throws:
BadLocationException - if line is unknown to this tracker

getLineNumberOfOffset

int getLineNumberOfOffset(int offset)
                          throws 
BadLocationException
Returns the line number the character at the given offset belongs to.

Parameters:
offset - the offset whose line number to be determined
Returns:
the number of the line the offset is on
Throws:
BadLocationException - if the offset is invalid in this tracker

getLineInformationOfOffset

IRegion getLineInformationOfOffset(int offset)
                                   throws 
BadLocationException
Returns a line description of the line at the given offset. The description contains the start offset and the length of the line excluding the line's delimiter.

Parameters:
offset - the offset whose line should be described
Returns:
a region describing the line
Throws:
BadLocationException - if offset is invalid in this tracker

getLineInformation

IRegion getLineInformation(int line)
                           throws 
BadLocationException
Returns a line description of the given line. The description contains the start offset and the length of the line excluding the line's delimiter.

Parameters:
line - the line that should be described
Returns:
a region describing the line
Throws:
BadLocationException - if line is unknown to this tracker

replace

void replace(int offset,
             int length,
             
String text)
             throws 
BadLocationException
Informs the line tracker about the specified change in the tracked text.

Parameters:
offset - the offset of the replaced text
length - the length of the replaced text
text - the substitution text
Throws:
BadLocationException - if specified range is unknown to this tracker

set

void set(
String text)
Sets the tracked text to the specified text.

Parameters:
text - the new tracked text

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