Package org.eclipse.jface.text
Class BlockTextSelection
java.lang.Object
org.eclipse.jface.text.TextSelection
org.eclipse.jface.text.BlockTextSelection
- All Implemented Interfaces:
IBlockTextSelection,IMultiTextSelection,ITextSelection,ISelection
Standard implementation of
IBlockTextSelection.- Since:
- 3.5
-
Constructor Summary
ConstructorsConstructorDescriptionBlockTextSelection(IDocument document, int startLine, int startColumn, int endLine, int endColumn, int tabWidth) Creates a column selection for the given lines and columns. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintReturns the exclusive column on the end line at which the selection ends.intReturns the number of the line containing the last character of the selected text.IRegion[]Returns a non-empty array containing the selected text range for each line covered by the selection.intReturns the column on the start line at which the selection starts.intReturns number of the line containing the offset of the selected text.getText()Returns the selected text.inthashCode()toString()Methods inherited from class org.eclipse.jface.text.TextSelection
emptySelection, getDocument, getLength, getOffset, isEmptyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.ISelection
isEmptyMethods inherited from interface org.eclipse.jface.text.ITextSelection
getLength, getOffset
-
Constructor Details
-
BlockTextSelection
public BlockTextSelection(IDocument document, int startLine, int startColumn, int endLine, int endColumn, int tabWidth) Creates a column selection for the given lines and columns.- Parameters:
document- the document that this selection refers tostartLine- the start linestartColumn- the possibly virtual start column, measured in characters from the start ofstartLineendLine- the inclusive end lineendColumn- the exclusive and possibly virtual end column, measured in characters from the start ofendLinetabWidth- the tabulator width used to compute the visual offsets from character offsets
-
-
Method Details
-
getStartLine
public int getStartLine()Description copied from interface:ITextSelectionReturns 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.- Specified by:
getStartLinein interfaceITextSelection- Overrides:
getStartLinein classTextSelection- Returns:
- the start line of this selection or -1 if there is no valid line information
-
getStartColumn
public int getStartColumn()Description copied from interface:IBlockTextSelectionReturns 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.- Specified by:
getStartColumnin interfaceIBlockTextSelection- Returns:
- the start column measured from the line start
-
getEndLine
public int getEndLine()Description copied from interface:ITextSelectionReturns 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.- Specified by:
getEndLinein interfaceITextSelection- Overrides:
getEndLinein classTextSelection- Returns:
- the end line of this selection or -1 if there is no valid line information
-
getEndColumn
public int getEndColumn()Description copied from interface:IBlockTextSelectionReturns 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.- Specified by:
getEndColumnin interfaceIBlockTextSelection- Returns:
- the end column measured from the line start
-
getText
Description copied from interface:ITextSelectionReturns 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.- Specified by:
getTextin interfaceIBlockTextSelection- Specified by:
getTextin interfaceITextSelection- Overrides:
getTextin classTextSelection- Returns:
- the selected text or
nullif there is no valid text information - See Also:
-
hashCode
public int hashCode()- Overrides:
hashCodein classTextSelection
-
equals
- Overrides:
equalsin classTextSelection
-
getRegions
Description copied from interface:IMultiTextSelectionReturns a non-empty array containing the selected text range for each line covered by the selection.- Specified by:
getRegionsin interfaceIBlockTextSelection- Specified by:
getRegionsin interfaceIMultiTextSelection- Overrides:
getRegionsin classTextSelection- Returns:
- an array containing a the covered text range for each line covered by the receiver
- See Also:
-
toString
- Overrides:
toStringin classTextSelection- Since:
- 3.16
-