Package org.eclipse.jface.text.source

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


    IAnnotationModel model= fProjectionViewer.getAnnotationModel();
    if (model == null)
      return;
    Iterator e= model.getAnnotationIterator();
    while (e.hasNext()) {
      Annotation annotation= (Annotation) e.next();
      AnnotationBag bag= findBagForType(map, annotation.getType());
      if (bag != null) {
        Position position= model.getPosition(annotation);
        if (includes(summaryRegions, position))
          bag.add(annotation);
      }
View Full Code Here


      return;
    }
   
    Iterator itor = model.getAnnotationIterator();
    while( itor.hasNext() ){
      Annotation a = (Annotation) itor.next();
      model.removeAnnotation(a);
    }
  }
View Full Code Here

                    // if(errorPart instanceof LdifUnknownPart) {
                    // errorOffset = container.getOffset();
                    // errorLength = container.getLength();
                    // errorText = new StringBuffer(container.toString());
                    // }
                    Annotation annotation = new Annotation( ERROR_ANNOTATION_TYPE, true, errorText.toString() );
                    Position position = new Position( errorOffset, errorLength );
                    positionList.add( position );
                    viewer.getAnnotationModel().addAnnotation( annotation, position );
                }
View Full Code Here

    // find out which regions need to be removed/added
    ArrayList<Annotation> annotationsToRemove = new ArrayList<Annotation>();
    Iterator<Annotation> annotationIterator = fAnnotationModel.getAnnotationIterator();
    while (annotationIterator.hasNext()) {
      Annotation currentAnnotation = annotationIterator.next();
      Position currentPosition = new Position(fAnnotationModel.getPosition(currentAnnotation).offset, fAnnotationModel.getPosition(currentAnnotation).length);
      if (!fFoldingRegions.contains(currentPosition)) {
        // folding region vanished -> remove it's Annotation
        annotationsToRemove.add(currentAnnotation);
      } else {
View Full Code Here

    if (model == null)
      return null;
   
    Iterator e= model.getAnnotationIterator();
    while (e.hasNext()) {
      Annotation a= (Annotation) e.next();
      if (isIncluded(a)) {
        Position p= model.getPosition(a);
        if (p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
          String msg= a.getText();
          if (msg != null && msg.trim().length() > 0)
            return msg;
        }
      }
    }
View Full Code Here

  }

  private void expand() {
    if (isProjectionMode()) {
      Position found= null;
      Annotation bestMatch= null;
      Point selection= getSelectedRange();
      for (Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) {
        ProjectionAnnotation annotation= (ProjectionAnnotation) e.next();
        if (annotation.isCollapsed()) {
          Position position= fProjectionAnnotationModel.getPosition(annotation);
View Full Code Here

  }

  private void collapse() {
    if (isProjectionMode()) {
      Position found= null;
      Annotation bestMatch= null;
      Point selection= getSelectedRange();
      for (Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) {
        ProjectionAnnotation annotation= (ProjectionAnnotation) e.next();
        if (!annotation.isCollapsed()) {
          Position position= fProjectionAnnotationModel.getPosition(annotation);
View Full Code Here

      for (Iterator it= revision.getRegions().iterator(); it.hasNext();) {
        RevisionRange range= (RevisionRange) it.next();
        try {
          IRegion charRegion= toCharRegion(range);
          Position position= new Position(charRegion.getOffset(), charRegion.getLength());
          Annotation annotation= new RevisionAnnotation(revision.getId());
          added.put(annotation, position);
        } catch (BadLocationException x) {
          // ignore - document was changed, show no annotations
        }
      }
    }

    if (fAnnotationModel instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension ext= (IAnnotationModelExtension) fAnnotationModel;
      ext.replaceAnnotations((Annotation[]) fAnnotations.toArray(new Annotation[fAnnotations.size()]), added);
    } else {
      for (Iterator it= fAnnotations.iterator(); it.hasNext();) {
        Annotation annotation= (Annotation) it.next();
        fAnnotationModel.removeAnnotation(annotation);
      }
      if (added != null) {
        for (Iterator it= added.entrySet().iterator(); it.hasNext();) {
          Entry entry= (Entry) it.next();
View Full Code Here

                    int start = invalidFilters[i].getStartToken().getOffset();
                    int stop = invalidFilters[i].getStopToken() != null ? invalidFilters[i].getStopToken().getOffset()
                        + invalidFilters[i].getStopToken().getLength() : start
                        + invalidFilters[i].getStartToken().getLength();

                    Annotation annotation = new Annotation( "DEFAULT", true, invalidFilters[i].toString() ); //$NON-NLS-1$
                    Position position = new Position( start, stop - start );
                    positionList.add( position );
                    sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
                }
            }

            for ( int i = 0; i < tokens.length; i++ )
            {
                if ( tokens[i].getType() == LdapFilterToken.ERROR )
                {

                    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;
                        }
                    }
                    if ( !overlaps )
                    {
                        Annotation annotation = new Annotation( "DEFAULT", true, tokens[i].getValue() ); //$NON-NLS-1$
                        Position position = new Position( tokens[i].getOffset(), tokens[i].getLength() );
                        sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
                    }
                }
            }
View Full Code Here

    String content = document.get();
    int index = content.indexOf(word);
    while (index != -1) {
      if (QVTEditorUtilities.getWordAtOffset(document.get(), index)
          .length() == word.length()) {
        Annotation annotation = new Annotation(
            UiPlugin.SEARCH_ANNOTATION_TYPE, false, word);
        Position position = new Position(index, word.length());
        model.addAnnotation(annotation, position);
      }
      index = content.indexOf(word, index + 1);
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.