Package org.eclipse.jface.text
Interface IBlockTextSelection
- All Superinterfaces:
ISelection
,ITextSelection
- All Known Implementing Classes:
BlockTextSelection
A rectangular selection in a text document. A column selection spans the visually identical range
of columns on a contiguous range of lines. The character count of the same visually perceived
column may not be equal for two different lines, therefore computing the set of disjunct
character ranges covered by a column selection is influenced by the used font and tabulator
width. Using column selections with proportional fonts may render unexpected results.
Virtual Spaces
The start column and end column may refer to "virtual offsets" in the white space beyond the end of the line. Such an offset can be realized by inserting a space for each missing character.
The offset and length of an IBlockTextSelection
refer to the smallest non-virtual range that comprises
the entire rectangular selection.
Clients may implement this interface or use the default implementation provided by
BlockTextSelection
.
- Since:
- 3.5
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the exclusive column on the end line at which the selection ends.IRegion[]
Returns a non-empty array containing the selected text range for each line covered by the selection.int
Returns the column on the start line at which the selection starts.getText()
Returns the selected text.Methods inherited from interface org.eclipse.jface.viewers.ISelection
isEmpty
Methods inherited from interface org.eclipse.jface.text.ITextSelection
getEndLine, getLength, getOffset, getStartLine
-
Method Details
-
getStartColumn
int getStartColumn()Returns the column on the start line at which the selection starts. The returned column is a character count measured from the start of the line. It may be larger than the length of the line, in which case it is a virtual offset.- Returns:
- the start column measured from the line start
-
getEndColumn
int getEndColumn()Returns the exclusive column on the end line at which the selection ends. The returned column is a character count measured from the start of the line. It may be larger than the length of the line, in which case it is a virtual offset.- Returns:
- the end column measured from the line start
-
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.The returned text does not necessarily correspond to the total offset and
length
, as only the text within the selected columns is returned.Any virtual spaces beyond the end of the selected lines are materialized and returned as text.
- Specified by:
getText
in interfaceITextSelection
- Returns:
- the selected text or
null
if there is no valid text information - See Also:
-
getRegions
IRegion[] getRegions()Returns a non-empty array containing the selected text range for each line covered by the selection.- Returns:
- an array containing a the covered text range for each line covered by the receiver
- See Also:
-