Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITextViewerExtension5.widgetOffset2ModelOffset()


   * @since 2.1
   */
  protected static final int widgetOffset2ModelOffset(ISourceViewer viewer, int widgetOffset) {
    if (viewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) viewer;
      return extension.widgetOffset2ModelOffset(widgetOffset);
    }
    return widgetOffset + viewer.getVisibleRegion().getOffset();
  }

  /**
 
View Full Code Here


        int widgetCaret = text.getCaretOffset();

        int modelCaret = 0;
        if (viewer instanceof ITextViewerExtension5) {
            ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
            modelCaret = extension.widgetOffset2ModelOffset(widgetCaret);
        } else {
            IRegion visibleRegion = viewer.getVisibleRegion();
            modelCaret = widgetCaret + visibleRegion.getOffset();
        }
View Full Code Here

          textWidget.setFocus();
        if (expandExistingSelection && fCachedTextViewer instanceof ITextViewerExtension5 && textWidget != null) {
          ITextViewerExtension5 extension5= ((ITextViewerExtension5)fCachedTextViewer);
          // Find model cursor position
          int widgetCaret= textWidget.getCaretOffset();
          int modelCaret= extension5.widgetOffset2ModelOffset(widgetCaret);
          // Find model selection range
          Point selection= fCachedTextViewer.getSelectedRange();
          // Start from tail of selection range (opposite of cursor position)
          int startOffset= modelCaret == selection.x ? selection.x + selection.y : selection.x;
View Full Code Here

              widgetOffset--;

            // Convert to model offset
            if (fCachedTextViewer instanceof ITextViewerExtension5) {
              ITextViewerExtension5 extension= (ITextViewerExtension5)fCachedTextViewer;
              offset= extension.widgetOffset2ModelOffset(widgetOffset);
            } else
              offset= widgetOffset + fCachedTextViewer.getVisibleRegion().getOffset();

          } catch (IllegalArgumentException ex) {
            int lineEndOffset= lineInfo.getOffset() + lineInfo.getLength();
View Full Code Here

    IDocument document = viewer.getDocument();
    // CMVC 252634 to compensate for "invisible" initial region
    int caretOffset = viewer.getTextWidget().getCaretOffset();
    if (viewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
      caretOffset = extension.widgetOffset2ModelOffset(caretOffset);
    }
    else {
      caretOffset = viewer.getTextWidget().getCaretOffset()
          + viewer.getVisibleRegion().getOffset();
    }
View Full Code Here

    IDocument document = viewer.getDocument();
    // CMVC 252634 to compensate for "invisible" initial region
    int caretOffset = viewer.getTextWidget().getCaretOffset();
    if (viewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
      caretOffset = extension.widgetOffset2ModelOffset(caretOffset);
    }
    else {
      caretOffset = viewer.getTextWidget().getCaretOffset()
          + viewer.getVisibleRegion().getOffset();
    }
View Full Code Here

      return null;

    int caret = 0;
    if (sourceViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
      caret = extension.widgetOffset2ModelOffset(styledText
          .getCaretOffset());
    }
    else {
      int offset = sourceViewer.getVisibleRegion().getOffset();
      caret = offset + styledText.getCaretOffset();
View Full Code Here

      return null;

    int caret = 0;
    if (sourceViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
      caret = extension.widgetOffset2ModelOffset(styledText.getCaretOffset());
    }
    else {
      int offset = sourceViewer.getVisibleRegion().getOffset();
      caret = offset + styledText.getCaretOffset();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.