Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Position.overlapsWith()


      int index= document.computeIndexInCategory(getCategory(), event.getOffset());
      Position[] fragments= document.getPositions(getCategory());

      if (0 < index) {
        Position fragment= fragments[index - 1];
        if (fragment.overlapsWith(event.getOffset(), event.getLength()))
          return true;
        if (index == fragments.length && fragment.offset + fragment.length == event.getOffset())
          return true;
      }
View Full Code Here


          return true;
      }

      if (index < fragments.length) {
        Position fragment= fragments[index];
        return fragment.overlapsWith(event.getOffset(), event.getLength());
      }

    } catch (BadLocationException x) {
    } catch (BadPositionCategoryException x) {
    }
View Full Code Here

  private Position[] computeOverlappingAnnotationPositions(IRegion modelSelection) {
    List positions= new ArrayList();
    for (Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) {
      ProjectionAnnotation annotation= (ProjectionAnnotation) e.next();
      Position position= fProjectionAnnotationModel.getPosition(annotation);
      if (position != null && position.overlapsWith(modelSelection.getOffset(), modelSelection.getLength()) && modelRange2WidgetRange(position) != null)
        positions.add(position);
    }
    return (Position[]) positions.toArray(new Position[positions.size()]);
  }
View Full Code Here

          Annotation a= (Annotation) e.next();
          Position p= fModel.getPosition(a);

          if (p == null)
            continue;
          if (visible != null && !p.overlapsWith(visible.getOffset(), visible.getLength()))
            continue;

          int annotationOffset= p.getOffset();
          int annotationLength= p.getLength();
          IRegion widgetRegion= null;
View Full Code Here

                    boolean overlaps = false;
                    for ( int k = 0; k < positionList.size(); k++ )
                    {
                        Position pos = positionList.get( k );
                        if ( pos.overlapsWith( tokens[i].getOffset(), tokens[i].getLength() ) )
                        {
                            overlaps = true;
                            break;
                        }
                    }
View Full Code Here

                for (int i = 0; e.hasNext(); i++) {

                    Annotation a = (Annotation) e.next();
                    Position p = fModel.getPosition(a);

                    if (p == null || !p.overlapsWith(visible.getOffset(), visible.getLength()))
                        continue;

                    int annotationOffset = Math.max(p.getOffset(), visible.getOffset());
                    int annotationEnd = Math.min(p.getOffset() + p.getLength(),
                            visible.getOffset() + visible.getLength());
View Full Code Here

      if (previous != null) {
        gapOffset= previous.getOffset() + previous.getLength();
        gap.setOffset(gapOffset);
        gap.setLength(fDocument.getLength() - gapOffset);
        if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
            (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
          start= Math.max(offset, gapOffset);
          end= Math.min(endOffset, fDocument.getLength());
          list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
        }
      }
View Full Code Here

        // remove all affected positions
        while (first < category.length) {
          TypedPosition p= (TypedPosition) category[first];
          if (lastScannedPosition >= p.offset + p.length ||
              (p.overlapsWith(start, length) &&
                 (!fDocument.containsPosition(fPositionCategory, start, length) ||
                  !contentType.equals(p.getType())))) {

            rememberRegion(p.offset, p.length);
            fDocument.removePosition(fPositionCategory, p);
View Full Code Here

        gapOffset= (previous != null) ? previous.getOffset() + previous.getLength() : 0;
        gap.setOffset(gapOffset);
        gap.setLength(current.getOffset() - gapOffset);
        if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
            (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
          start= Math.max(offset, gapOffset);
          end= Math.min(endOffset, gap.getOffset() + gap.getLength());
          list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
        }
View Full Code Here

      if (previous != null) {
        gapOffset= previous.getOffset() + previous.getLength();
        gap.setOffset(gapOffset);
        gap.setLength(fDocument.getLength() - gapOffset);
        if ((includeZeroLengthPartitions && overlapsOrTouches(gap, offset, length)) ||
            (gap.getLength() > 0 && gap.overlapsWith(offset, length))) {
          start= Math.max(offset, gapOffset);
          end= Math.min(endOffset, fDocument.getLength());
          list.add(new TypedRegion(start, end - start, IDocument.DEFAULT_CONTENT_TYPE));
        }
      }
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.