Examples of widgetOffset2ModelOffset()


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

        }

        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

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

        }

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

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

        try {
            final int widgetLocation = styledText.getOffsetAtLocation(new Point(x, y));
            if (textViewer instanceof ITextViewerExtension5) {
                final ITextViewerExtension5 extension = (ITextViewerExtension5) textViewer;
                return extension.widgetOffset2ModelOffset(widgetLocation);
            }
            final IRegion visibleRegion = textViewer.getVisibleRegion();
            return widgetLocation + visibleRegion.getOffset();
        } catch (final IllegalArgumentException e) {
            return -1;
View Full Code Here

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

        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

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

              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

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

   * @return document offset
   */
  private int getDocumentOffset(int widgetOffset) {
    if (fTextViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5)fTextViewer;
      return extension.widgetOffset2ModelOffset(widgetOffset);
    }
    IRegion visible= fTextViewer.getVisibleRegion();
    if (widgetOffset > visible.getLength()) {
      return -1;
    }
View Full Code Here

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

        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

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

   * @since 2.1
   */
  protected final static 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

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

    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

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

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

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