Tabnine Logo
TextViewer._getVisibleRegionOffset
Code IndexAdd Tabnine to your IDE (free)

How to use
_getVisibleRegionOffset
method
in
org.eclipse.jface.text.TextViewer

Best Java code snippets using org.eclipse.jface.text.TextViewer._getVisibleRegionOffset (Showing top 2 results out of 315)

origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Computes the document offset underlying the given text widget coordinates.
 * This method uses a linear search as it cannot make any assumption about
 * how the document is actually presented in the widget. (Covers cases such
 * as bidirectional text.)
 *
 * @param x the horizontal coordinate inside the text widget
 * @param y the vertical coordinate inside the text widget
 * @return the document offset corresponding to the given point
 */
private int computeOffsetAtLocation(int x, int y) {
  try {
    StyledText styledText= fTextViewer.getTextWidget();
    int widgetOffset= styledText.getOffsetAtLocation(new Point(x, y));
    Point p= styledText.getLocationAtOffset(widgetOffset);
    if (p.x > x)
      widgetOffset--;
    if (fTextViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
      return extension.widgetOffset2ModelOffset(widgetOffset);
    }
    return widgetOffset + fTextViewer._getVisibleRegionOffset();
  } catch (IllegalArgumentException e) {
    return -1;
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Computes the document offset underlying the given text widget coordinates.
 * This method uses a linear search as it cannot make any assumption about
 * how the document is actually presented in the widget. (Covers cases such
 * as bidirectional text.)
 *
 * @param x the horizontal coordinate inside the text widget
 * @param y the vertical coordinate inside the text widget
 * @return the document offset corresponding to the given point
 */
private int computeOffsetAtLocation(int x, int y) {
  try {
    StyledText styledText= fTextViewer.getTextWidget();
    int widgetOffset= styledText.getOffsetAtPoint(new Point(x, y));
    if (widgetOffset == -1) {
      return -1;
    }
    Point p= styledText.getLocationAtOffset(widgetOffset);
    if (p.x > x) {
      widgetOffset--;
    }
    if (fTextViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
      return extension.widgetOffset2ModelOffset(widgetOffset);
    }
    return widgetOffset + fTextViewer._getVisibleRegionOffset();
  } catch (IllegalArgumentException e) {
    return -1;
  }
}
org.eclipse.jface.textTextViewer_getVisibleRegionOffset

Javadoc

Returns the offset of the visible region.

Popular methods of TextViewer

  • getTextWidget
  • getControl
  • doOperation
  • setDocument
  • modelRange2WidgetRange
    Same as #modelRange2WidgetRange(IRegion) just for a org.eclipse.jface.text.Position.
  • getRewriteTarget
  • getSelection
  • modelLine2WidgetLine
    Implements the contract of ITextViewerExtension5#modelLine2WidgetLine(int).
  • getDocument
  • setSelectedRange
  • setSelection
  • <init>
    Create a new text viewer with the given SWT style bits. The viewer is ready to use but does not have
  • setSelection,
  • <init>,
  • canDoOperation,
  • getVisibleRegion,
  • handleDispose,
  • invalidateTextPresentation,
  • setTopIndex,
  • activatePlugins,
  • addPresentation

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now