Package org.eclipse.jface.text.source

Examples of org.eclipse.jface.text.source.Annotation


   * @return the found annotation
   * @since 3.2
   */
  protected Annotation findAnnotation(final int offset, final int length, boolean forward, Position annotationPosition) {

    Annotation nextAnnotation= null;
    Position nextAnnotationPosition= null;
    Annotation containingAnnotation= null;
    Position containingAnnotationPosition= null;
    boolean currentAnnotation= false;

    IDocument document= getDocumentProvider().getDocument(getEditorInput());
    int endOfDocument= document.getLength();
    int distance= Integer.MAX_VALUE;

    IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
    Iterator e= model.getAnnotationIterator();
    while (e.hasNext()) {
      Annotation a= (Annotation) e.next();
      if (!isNavigationTarget(a))
        continue;

      Position p= model.getPosition(a);
      if (p == null)
View Full Code Here


 
    boolean supportsBatchReplace= (model instanceof IAnnotationModelExtension);
    List toBeRemovedAnnotations= new ArrayList();
    Iterator iter= model.getAnnotationIterator();
    while (iter.hasNext()) {
      Annotation annotation= (Annotation) iter.next();
      if (SpellingAnnotation.TYPE.equals(annotation.getType())) {
        boolean doRemove= word == null;
        if (word == null)
          doRemove= true;
        else {
          String annotationWord= null;
View Full Code Here

          ((IAnnotationModelExtension)fAnnotationModel).replaceAnnotations(annotationsToRemove, fAddAnnotations);
        else {
          for (int i= 0; i < annotationsToRemove.length; i++)
            fAnnotationModel.removeAnnotation(annotationsToRemove[i]);
          for (iter= fAddAnnotations.keySet().iterator(); iter.hasNext();) {
            Annotation annotation= (Annotation)iter.next();
            fAnnotationModel.addAnnotation(annotation, (Position)fAddAnnotations.get(annotation));
          }
        }
      }
View Full Code Here

   * select marker annotation.
   * </p>
   * @since 3.2
   */
  public Annotation gotoAnnotation(boolean forward) {
    Annotation annotation= super.gotoAnnotation(forward);
    if (annotation != null)
      updateMarkerViews(annotation);
    return annotation;
  }
View Full Code Here

    int maxLayer= 0;

    Iterator iter= markers.iterator();
    while (iter.hasNext()) {
      IMarker m= (IMarker) iter.next();
      Annotation a= model.getMarkerAnnotation(m);
      if (a != null) {
        if (access == null) {
          marker= m;
          break;
        }
View Full Code Here

      return Collections.EMPTY_LIST;

    final int activeLine= fRuler.getLineOfLastMouseButtonActivity();
    List markers= null;
    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)) {
          if (markers == null)
            markers= new ArrayList(10);
View Full Code Here

    if (allMarkers.length == 0)
      return false;

    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

  protected void removeAnnotations(List annotations, boolean fireModelChanged, boolean modelInitiated) {
    if (annotations != null && annotations.size() > 0) {

      List markerAnnotations= new ArrayList();
      for (Iterator e= annotations.iterator(); e.hasNext();) {
        Annotation a= (Annotation) e.next();
        if (a instanceof MarkerAnnotation)
          markerAnnotations.add(a);

        // remove annotations from annotation model
        removeAnnotation(a, false);
View Full Code Here

   * @throws CoreException if there is a problem getting the markers
   */
  private void catchupWithMarkers() throws CoreException {

    for (Iterator e=getAnnotationIterator(false); e.hasNext();) {
      Annotation a= (Annotation) e.next();
      if (a instanceof MarkerAnnotation)
        removeAnnotation(a, false);
    }

    IMarker[] markers= retrieveMarkers();
View Full Code Here

      ArrayList allAnnotations = new ArrayList();
      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

TOP

Related Classes of org.eclipse.jface.text.source.Annotation

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.