Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.ITextViewerExtension5


      return;

    int widgetOffset= 0;
    if (fViewer instanceof ITextViewerExtension5) {

      ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer;
      widgetOffset= extension.modelOffset2WidgetOffset(position.getOffset());
      if (widgetOffset == -1)
        return;

    } else {
View Full Code Here


   * @return the corresponding widget range
   * @since 2.1
   */
  private IRegion modelRange2WidgetRange(IRegion region) {
    if (fTextViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
      return extension.modelRange2WidgetRange(region);
    }

    IRegion visibleRegion= fTextViewer.getVisibleRegion();
    int start= region.getOffset() - visibleRegion.getOffset();
    int end= start + region.getLength();
View Full Code Here

    IAnnotationAccessExtension annotationAccessExtension= null;
    if (fAnnotationAccess instanceof IAnnotationAccessExtension)
      annotationAccessExtension= (IAnnotationAccessExtension) fAnnotationAccess;

    ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
    StyledText textWidget= fTextViewer.getTextWidget();

    fScrollPos= textWidget.getTopPixel();
    Point dimension= fCanvas.getSize();

    // draw Annotations
    Rectangle r= new Rectangle(0, 0, 0, 0);
    int maxLayer= 1// loop at least once through layers.

    for (int layer= 0; layer < maxLayer; layer++) {
      Iterator iter= fModel.getAnnotationIterator();
      while (iter.hasNext()) {
        IAnnotationPresentation annotationPresentation= null;
        Annotation annotation= (Annotation) iter.next();

        int lay= IAnnotationAccessExtension.DEFAULT_LAYER;
        if (annotationAccessExtension != null)
          lay= annotationAccessExtension.getLayer(annotation);
        else if (annotation instanceof IAnnotationPresentation) {
          annotationPresentation= (IAnnotationPresentation)annotation;
          lay= annotationPresentation.getLayer();
        }
        maxLayer= Math.max(maxLayer, lay+1)// dynamically update layer maximum
        if (lay != layer// wrong layer: skip annotation
          continue;

        Position position= fModel.getPosition(annotation);
        if (position == null)
          continue;

        IRegion widgetRegion= extension.modelRange2WidgetRange(new Region(position.getOffset(), position.getLength()));
        if (widgetRegion == null)
          continue;

        int startLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset());
        if (startLine == -1)
          continue;

        int endLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset() + Math.max(widgetRegion.getLength() -1, 0));
        if (endLine == -1)
          continue;

        r.x= 0;
        r.y= JFaceTextUtil.computeLineHeight(textWidget, 0, startLine, startLine- fScrollPos;
View Full Code Here

   * @since 2.1
   */
  protected final static int widgetLine2ModelLine(ITextViewer viewer, int widgetLine) {

    if (viewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) viewer;
      return extension.widgetLine2ModelLine(widgetLine);
    }

    try {
      IRegion r= viewer.getVisibleRegion();
      IDocument d= viewer.getDocument();
View Full Code Here

  protected void doPaint1(GC gc) {

    if (fModel == null || fCachedTextViewer == null)
      return;

    ITextViewerExtension5 extension= (ITextViewerExtension5) fCachedTextViewer;

    fScrollPos= fCachedTextWidget.getTopPixel();
    Point dimension= fCanvas.getSize();

    int vOffset= getInclusiveTopIndexStartOffset();
    int vLength= getExclusiveBottomIndexEndOffset() - vOffset;

    // draw Annotations
    Rectangle r= new Rectangle(0, 0, 0, 0);
    ReusableRegion range= new ReusableRegion();

    int minLayer= Integer.MAX_VALUE, maxLayer= Integer.MIN_VALUE;
    fCachedAnnotations.clear();
    Iterator iter;
    if (fModel instanceof IAnnotationModelExtension2)
      iter= ((IAnnotationModelExtension2)fModel).getAnnotationIterator(vOffset, vLength + 1, true, true);
    else
      iter= fModel.getAnnotationIterator();

    while (iter.hasNext()) {
      Annotation annotation= (Annotation) iter.next();

      if (skip(annotation))
        continue;

      Position position= fModel.getPosition(annotation);
      if (position == null)
        continue;

      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=217710
      int extendedVLength= position.getLength() == 0 ? vLength + 1 : vLength;
      if (!position.overlapsWith(vOffset, extendedVLength))
        continue;

      int lay= IAnnotationAccessExtension.DEFAULT_LAYER;
      if (fAnnotationAccessExtension != null)
        lay= fAnnotationAccessExtension.getLayer(annotation);

      minLayer= Math.min(minLayer, lay);
      maxLayer= Math.max(maxLayer, lay);
      fCachedAnnotations.add(new Tuple(annotation, position));
    }
    Collections.sort(fCachedAnnotations, fTupleComparator);

    for (int layer= minLayer; layer <= maxLayer; layer++) {
      for (int i= 0, n= fCachedAnnotations.size(); i < n; i++) {
        Tuple tuple= (Tuple) fCachedAnnotations.get(i);
        Annotation annotation= tuple.annotation;
        Position position= tuple.position;

        int lay= IAnnotationAccessExtension.DEFAULT_LAYER;
        if (fAnnotationAccessExtension != null)
          lay= fAnnotationAccessExtension.getLayer(annotation);
        if (lay != layer// wrong layer: skip annotation
          continue;

        range.setOffset(position.getOffset());
        range.setLength(position.getLength());
        IRegion widgetRegion= extension.modelRange2WidgetRange(range);
        if (widgetRegion == null)
          continue;

        int startLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset());
        if (startLine == -1)
          continue;

        int endLine= extension.widgetLineOfWidgetOffset(widgetRegion.getOffset() + Math.max(widgetRegion.getLength() -1, 0));
        if (endLine == -1)
          continue;

        r.x= 0;
        r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine- fScrollPos;
View Full Code Here

        if (pp.fLayer != layer// wrong layer: skip annotation
          continue;

        Position p= pp.fPosition;
        if (fSourceViewer instanceof ITextViewerExtension5) {
          ITextViewerExtension5 extension3= (ITextViewerExtension5) fSourceViewer;
          if (null == extension3.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength())))
            continue;
        } else if (!fSourceViewer.overlapsWithVisibleRegion(p.offset, p.length)) {
          continue;
        }
View Full Code Here

   */
  private ILineRange modelLinesToWidgetLines(ILineRange range) {
    int widgetStartLine= -1;
    int widgetEndLine= -1;
    if (fViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fViewer;
      int modelEndLine= end(range);
      for (int modelLine= range.getStartLine(); modelLine < modelEndLine; modelLine++) {
        int widgetLine= extension.modelLine2WidgetLine(modelLine);
        if (widgetLine != -1) {
          if (widgetStartLine == -1)
            widgetStartLine= widgetLine;
          widgetEndLine= widgetLine;
        }
View Full Code Here

    int length= fPairPosition.getLength();
    if (length < 1)
      return;

    if (fSourceViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer;
      IRegion widgetRange= extension.modelRange2WidgetRange(new Region(offset, length));
      if (widgetRange == null)
        return;

      try {
        // don't draw if the pair position is really hidden and widgetRange just
        // marks the coverage around it.
        IDocument doc= fSourceViewer.getDocument();
        int startLine= doc.getLineOfOffset(offset);
        int endLine= doc.getLineOfOffset(offset + length);
        if (extension.modelLine2WidgetLine(startLine) == -1 || extension.modelLine2WidgetLine(endLine) == -1)
          return;
      } catch (BadLocationException e) {
        return;
      }
View Full Code Here

      Point p= text.getLocationAtOffset(widgetOffset);
      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

   * @since 3.0
   */
  private ILineRange adaptLineRangeToFolding(ILineRange lineRange, int line) {

    if (fSourceViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension= (ITextViewerExtension5) fSourceViewer;

      try {
        IRegion region= convertToRegion(lineRange);
        IRegion[] coverage= extension.getCoveredModelRanges(region);
        if (coverage != null && coverage.length > 0) {
          IRegion container= findRegionContainingLine(coverage, line);
          if (container != null)
            return convertToLineRange(container);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.ITextViewerExtension5

Copyright © 2018 www.massapicom. 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.