Package org.eclipse.jface.text

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


      Point relativePosition = text.toControl(absolutePosition);

      int widgetOffset = text.getOffsetAtLocation(relativePosition);
      if (getTextViewer() instanceof ITextViewerExtension5) {
        ITextViewerExtension5 extension = (ITextViewerExtension5) getTextViewer();
        return extension.widgetOffset2ModelOffset(widgetOffset);
      } else {
        return widgetOffset + getTextViewer().getVisibleRegion().getOffset();
      }

    } catch (IllegalArgumentException e) {
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

        if (expandExistingSelection && fCachedTextViewer instanceof ITextViewerExtension5
            && fCachedTextViewer.getTextWidget() != null) {
          ITextViewerExtension5 extension5= ((ITextViewerExtension5)fCachedTextViewer);
          // Find model curosr position
          int widgetCaret= fCachedTextViewer.getTextWidget().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

   */
  private int getModelCaret() {
    int widgetCaret= fViewer.getTextWidget().getCaretOffset();
    if (fViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer;
      return extension.widgetOffset2ModelOffset(widgetCaret);
    }
    IRegion visible= fViewer.getVisibleRegion();
    return widgetCaret + visible.getOffset();
  }

View Full Code Here

      if (p.x > relativePosition.x)
        widgetOffset--;
     
      if (fTextViewer instanceof ITextViewerExtension5) {
        ITextViewerExtension5 extension= (ITextViewerExtension5)fTextViewer;
        return extension.widgetOffset2ModelOffset(widgetOffset);
      }

      return widgetOffset + fTextViewer.getVisibleRegion().getOffset();

    } catch (IllegalArgumentException e) {
View Full Code Here

    ISourceViewer sourceViewer = getSourceViewer();
    StyledText styledText = sourceViewer.getTextWidget();
    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();
    }
    RutaReferenceVisitor visitor1 = new RutaReferenceVisitor(caret);
View Full Code Here

      throws BadLocationException {
    int widgetCaret= fViewer.getTextWidget().getCaretOffset();
    if (fViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 ext= (ITextViewerExtension5) fViewer;
      try {
        return ext.widgetOffset2ModelOffset(textWidget.getOffsetAtLocation(point));
      } catch (IllegalArgumentException e) {
        int docLineIndex= ext.widgetLine2ModelLine(textWidget.getLineIndex(point.y));
        String lineDelimiter= document.getLineDelimiter(docLineIndex);
        int delimLength= lineDelimiter == null ? 0 : lineDelimiter.length();
        return document.getLineOffset(docLineIndex) + document.getLineLength(docLineIndex)
View Full Code Here

        if (p.x > x)
          widgetOffset--;

        if (textViewer instanceof ITextViewerExtension5) {
          ITextViewerExtension5 extension= (ITextViewerExtension5) textViewer;
          return extension.widgetOffset2ModelOffset(widgetOffset);
        }
        IRegion visibleRegion= textViewer.getVisibleRegion();
        return widgetOffset + visibleRegion.getOffset();
      } catch (IllegalArgumentException e) {
        return -1;
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.