Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Position


    final int activeLine= fRuler.getLineOfLastMouseButtonActivity();
    for (Iterator it= model.getAnnotationIterator(); it.hasNext();) {
      Annotation annotation= (Annotation) it.next();
      if (annotation instanceof MarkerAnnotation) {
        Position position= model.getPosition(annotation);
        if (includesLine(position, document, activeLine)) {
          return true;
        }
      }
    }
View Full Code Here


        }
      }
    }

    if (start > -1 && end > -1)
      return new Position(start, end - start);

    return null;
  }
View Full Code Here

   * @see #isAcceptable(IMarker)
   */
  protected final void addMarkerAnnotation(IMarker marker) {

    if (isAcceptable(marker)) {
      Position p= createPositionFromMarker(marker);
      if (p != null)
        try {
          MarkerAnnotation annotation= createMarkerAnnotation(marker);
          if (annotation != null)
            addAnnotation(annotation, p, false);
View Full Code Here

   * @param marker the marker
   */
  protected void modifyMarkerAnnotation(IMarker marker) {
    MarkerAnnotation a= getMarkerAnnotation(marker);
    if (a != null) {
      Position p= createPositionFromMarker(marker);
      if (p != null) {
        a.update();
        modifyAnnotationPosition(a, p, false);
      }
    } else
View Full Code Here

      for (Iterator e= getAnnotationIterator(false); e.hasNext();) {
        Object o= e.next();
        if (o instanceof MarkerAnnotation) {
          MarkerAnnotation a= (MarkerAnnotation) o;
          IMarker marker= a.getMarker();
          Position position= (Position) annotationMap.get(a);
          if ( !updateMarker(marker, document, position)) {
            if ( !fDeletedAnnotations.contains(a))
              fDeletedAnnotations.add(a);
          }
        }
View Full Code Here

    // re-initializes the positions from the markers
    for (Iterator e= getAnnotationIterator(false); e.hasNext();) {
      Object o= e.next();
      if (o instanceof MarkerAnnotation) {
        MarkerAnnotation a= (MarkerAnnotation) o;
        Position p= createPositionFromMarker(a.getMarker());
        if (p != null) {
          removeAnnotation(a, false);
          try {
            addAnnotation(a, p, false);
          } catch (BadLocationException e1) {
            // ignore invalid position
          }
        }
      }
    }

    // add the markers of deleted positions back to the annotation model
    for (Iterator e= fDeletedAnnotations.iterator(); e.hasNext();) {
      Object o= e.next();
      if (o instanceof MarkerAnnotation) {
        MarkerAnnotation a= (MarkerAnnotation) o;
        Position p= createPositionFromMarker(a.getMarker());
        if (p != null)
          try {
            addAnnotation(a, p, false);
          } catch (BadLocationException e1) {
            // ignore invalid position
View Full Code Here

      ArrayList allPositions = new ArrayList();
      int bestOffset = Integer.MAX_VALUE;
      while (iter.hasNext()) {
        Annotation annot = (Annotation) iter.next();
        if (RutaCorrectionProcessor.isQuickFixableType(annot)) {
          Position pos = model.getPosition(annot);
          if (pos != null && isInside(pos.offset, rangeStart, rangeEnd)) { // inside
            // our
            // range?
            allAnnotations.add(annot);
            allPositions.add(pos);
            bestOffset = processAnnotation(annot, pos, invocationLocation, bestOffset);
          }
        }
      }
      if (bestOffset == Integer.MAX_VALUE) {
        return invocationLocation;
      }
      for (int i = 0; i < allPositions.size(); i++) {
        Position pos = (Position) allPositions.get(i);
        if (isInside(bestOffset, pos.offset, pos.offset + pos.length)) {
          resultingAnnotations.add(allAnnotations.get(i));
        }
      }
      return bestOffset;
    } else {
      while (iter.hasNext()) {
        Annotation annot = (Annotation) iter.next();
        if (RutaCorrectionProcessor.isQuickFixableType(annot)) {
          Position pos = model.getPosition(annot);
          if (pos != null && isInside(invocationLocation, pos.offset, pos.offset + pos.length)) {
            resultingAnnotations.add(annot);
          }
        }
      }
View Full Code Here

    super.possibleCompletionsClosed();
    restorePosition();
  }

  private void storePosition(int currOffset, int currLength) {
    fPosition = new Position(currOffset, currLength);
  }
View Full Code Here

      }
      List<ASTNode> result = refFinder.getResult();
      myAnnotations = new HashMap<Annotation, Position>(result.size());
      for (ASTNode each : result) {
        Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
        Position position = null;
        int sourceStart = each.sourceStart();
        int sourceEnd = each.sourceEnd();
        if (each instanceof RutaAction) {
          RutaAction e = (RutaAction) each;
          sourceStart = e.getNameStart();
          sourceEnd = e.getNameEnd();
        } else if (each instanceof RutaCondition) {
          RutaCondition e = (RutaCondition) each;
          sourceStart = e.getNameStart();
          sourceEnd = e.getNameEnd();
        }
        position = new Position(sourceStart, sourceEnd - sourceStart);
        myAnnotations.put(annotation, position);
      }
      addAnnotations(myAnnotations);
    }
View Full Code Here

    myAnnotations = new HashMap<Annotation, Position>();
    if (rule != null) {
      Annotation annotation = new Annotation(SearchPlugin.SEARCH_ANNOTATION_TYPE, true, null);
      int sourceStart = rule.sourceStart();
      int sourceEnd = rule.sourceEnd();
      Position position = new Position(sourceStart, sourceEnd - sourceStart);
      getSourceViewer().revealRange(sourceStart, sourceEnd - sourceStart);
      myAnnotations.put(annotation, position);
    }
    addAnnotations(myAnnotations);
  }
View Full Code Here

TOP

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

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.