|
Eclipse Platform Release 3.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.text.JFaceTextUtil
public final class JFaceTextUtil
A collection of JFace Text functions.
This class is neither intended to be instantiated nor subclassed.
Method Summary | |
---|---|
static Rectangle |
computeArea(IRegion region,
ITextViewer textViewer)
Determines the graphical area covered by the given text region in the given viewer. |
static int |
computeLineHeight(StyledText textWidget,
int startLine,
int endLine,
int lineCount)
Computes the line height for the given line range. |
static int |
getAverageCharWidth(Control control)
Returns the average character width of the given control's font. |
static int |
getBottomIndex(StyledText widget)
Returns the last fully visible line of the widget. |
static IRegion[] |
getCoveredRanges(ITextViewer viewer,
ITextSelection selection)
Returns the text regions covered by the given selection in the given viewer. |
static int |
getHiddenTopLinePixels(StyledText textWidget)
Returns the number of hidden pixels of the first partially visible line. |
static int |
getLineIndex(StyledText textWidget,
int y)
|
static int |
getLinePixel(StyledText textWidget,
int line)
|
static int |
getOffsetForCursorLocation(ITextViewer viewer)
Returns the offset in the given viewer that corresponds to the current cursor location. |
static int |
getPartialBottomIndex(ITextViewer viewer)
Returns the last, possibly partially, visible line in the view port. |
static int |
getPartialBottomIndex(StyledText widget)
Returns the index of the last (possibly only partially) visible line of the widget |
static int |
getPartialTopIndex(ITextViewer viewer)
Returns the line index of the first visible model line in the viewer. |
static int |
getPartialTopIndex(StyledText widget)
Returns the index of the first (possibly only partially) visible line of the widget |
static ILineRange |
getVisibleModelLines(ITextViewer viewer)
Returns the range of lines that is visible in the viewer, including any partially visible lines. |
static boolean |
isEmpty(ITextViewer viewer,
ITextSelection selection)
Returns true if the text covered by selection does not contain any
characters in the given viewer. |
static boolean |
isShowingEntireContents(StyledText widget)
Returns true if the widget displays the entire contents, i.e. it cannot
be vertically scrolled. |
static int |
modelLineToWidgetLine(ITextViewer viewer,
int modelLine)
Converts a model (i.e. |
static int |
widgetLine2ModelLine(ITextViewer viewer,
int widgetLine)
Converts a widget line into a model (i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int computeLineHeight(StyledText textWidget, int startLine, int endLine, int lineCount)
textWidget
- the StyledText
widgetstartLine
- the start lineendLine
- the end line (exclusive)lineCount
- the line count used by the old API
startLine
and ending above endLime
public static int getBottomIndex(StyledText widget)
widget
- the widget
public static int getPartialTopIndex(StyledText widget)
widget
- the widget
public static int getPartialBottomIndex(StyledText widget)
widget
- the text widget
public static int getPartialTopIndex(ITextViewer viewer)
viewer
- the text viewer
public static int getPartialBottomIndex(ITextViewer viewer)
viewer
- the text viewer
public static ILineRange getVisibleModelLines(ITextViewer viewer)
viewer
- the viewer
null
if no lines are
visiblepublic static int widgetLine2ModelLine(ITextViewer viewer, int widgetLine)
IDocument
) line using the
ITextViewerExtension5
if available, otherwise by adapting the widget line to the
viewer's visible region
.
viewer
- the viewerwidgetLine
- the widget line to convert.
widgetLine
or -1 to signal that there
is no corresponding model linepublic static int modelLineToWidgetLine(ITextViewer viewer, int modelLine)
IDocument
) line into a widget line using the
ITextViewerExtension5
if available, otherwise by adapting the model line to the
viewer's visible region
.
viewer
- the viewermodelLine
- the model line to convert.
modelLine
or -1 to signal that there
is no corresponding widget linepublic static int getHiddenTopLinePixels(StyledText textWidget)
textWidget
- the widget
public static int getLinePixel(StyledText textWidget, int line)
public static int getLineIndex(StyledText textWidget, int y)
public static boolean isShowingEntireContents(StyledText widget)
true
if the widget displays the entire contents, i.e. it cannot
be vertically scrolled.
widget
- the widget
true
if the widget displays the entire contents, i.e. it cannot
be vertically scrolled, false
otherwisepublic static Rectangle computeArea(IRegion region, ITextViewer textViewer)
region
- the region whose graphical extend must be computedtextViewer
- the text viewer containing the region
public static int getAverageCharWidth(Control control)
control
- the control to calculate the average char width for
public static boolean isEmpty(ITextViewer viewer, ITextSelection selection) throws BadLocationException
true
if the text covered by selection
does not contain any
characters in the given viewer. Note the difference to ISelection.isEmpty()
,
which returns true
only for invalid selections.
viewer
- the viewerselection
- the selection
true
if selection
does not contain any text,
false
otherwise
BadLocationException
- if accessing the document failedpublic static IRegion[] getCoveredRanges(ITextViewer viewer, ITextSelection selection) throws BadLocationException
viewer
- the viewerselection
- the selection
selection
BadLocationException
- if accessing the document failedpublic static int getOffsetForCursorLocation(ITextViewer viewer)
viewer
- the viewer
|
Eclipse Platform Release 3.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.