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 ITextSelection

All Superinterfaces:
ISelection
All Known Subinterfaces:
IBlockTextSelection
All Known Implementing Classes:
BlockTextSelection, TextSelection

public interface ITextSelection
extends ISelection

This interface represents a textual selection. A text selection is a range of characters. Although a text selection is a snapshot taken at a particular point in time, it must not copy the line information and the selected text from the selection provider.

If, for example, the selection provider is a text viewer ( ITextViewer), and a text selection is created for the range [5, 10], the line formation for the 5th character must not be determined and remembered at the point of creation. It can rather be determined at the point, when getStartLine is called. If the source viewer range [0, 15] has been changed in the meantime between the creation of the text selection object and the invocation of getStartLine, the returned line number may differ from the line number of the 5th character at the point of creation of the text selection object.

The contract of this interface is that weak in order to allow for efficient implementations.

Clients may implement this interface or use the default implementation provided by TextSelection.

See Also:
TextSelection

Method Summary
 int getEndLine ()
          Returns the number of the line containing the last character of the selected text.
 int getLength ()
          Returns the length of the selected text.
 int getOffset ()
          Returns the offset of the selected text.
 int getStartLine ()
          Returns number of the line containing the offset of the selected text.
  String getText ()
          Returns the selected text.
 
Methods inherited from interface org.eclipse.jface.viewers. ISelection
isEmpty
 

Method Detail

getOffset

int getOffset()
Returns the offset of the selected text.

Returns:
the offset of the selected text or -1 if there is no valid text information

getLength

int getLength()
Returns the length of the selected text.

Returns:
the length of the selected text or -1 if there is no valid text information

getStartLine

int getStartLine()
Returns number of the line containing the offset of the selected text. If the underlying text has been changed between the creation of this selection object and the call of this method, the value returned might differ from what it would have been at the point of creation.

Returns:
the start line of this selection or -1 if there is no valid line information

getEndLine

int getEndLine()
Returns the number of the line containing the last character of the selected text. If the underlying text has been changed between the creation of this selection object and the call of this method, the value returned might differ from what it would have been at the point of creation.

Returns:
the end line of this selection or -1 if there is no valid line information

getText

String getText()
Returns the selected text. If the underlying text has been changed between the creation of this selection object and the call of this method, the value returned might differ from what it would have been at the point of creation.

Returns:
the selected text or null if there is no valid text information

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