Package org.eclipse.jface.text.source

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


      index = content.indexOf(word, index + 1);
    }
  }

  private void removeOldAnnotations(IAnnotationModel model) {
    Annotation annotation = null;
    for (Iterator iter = model.getAnnotationIterator(); iter.hasNext();) {
      annotation = (Annotation) iter.next();
      if (UiPlugin.SEARCH_ANNOTATION_TYPE.equals(annotation.getType()))
        model.removeAnnotation(annotation);
    }
  }
View Full Code Here


    super.dispose();
  }

  @Override
  protected Annotation _addHoverAnnotation(IRegion selectedItem) {
    Annotation annotation = new Annotation(TemplateEditor.BINDING_HOVER_ANNOTATION, false, null);
    _woEditor.getWOSourceViewer().getAnnotationModel().addAnnotation(annotation, new Position(selectedItem.getOffset(), selectedItem.getLength()));
    return annotation;
  }
View Full Code Here

    List annotationsList = getAnnotationsForLine(_sourceViewer, _lineNumber);
    if (annotationsList != null) {
      List<String> messagesList = new ArrayList<String>();
      Iterator annotationsIter = annotationsList.iterator();
      while (annotationsIter.hasNext()) {
        Annotation annotation = (Annotation) annotationsIter.next();
        String message = annotation.getText();
        if (message != null) {
          message = message.trim();
          if (message.length() > 0) {
            messagesList.add(message);
          }
View Full Code Here

  }

  public String getHoverInfo(ITextViewer _textViewer, IRegion _hoverRegion) {
    Iterator annotationsIter = myAnnotationModel.getAnnotationIterator();
    while (annotationsIter.hasNext()) {
      Annotation annotation = (Annotation) annotationsIter.next();
      Position position = myAnnotationModel.getPosition(annotation);
      if (position.overlapsWith(_hoverRegion.getOffset(), _hoverRegion.getLength())) {
        String text = annotation.getText();
        if (text != null && text.trim().length() > 0) {
          return text;
        }
      }
    }
View Full Code Here

  public IRegion getHoverRegion(ITextViewer _textViewer, int _offset) {
    // TODO If this is too slow then we might return new Region(offset, 0)
    Iterator annotationsIter = myAnnotationModel.getAnnotationIterator();
    while (annotationsIter.hasNext()) {
      Annotation annotation = (Annotation) annotationsIter.next();
      Position position = myAnnotationModel.getPosition(annotation);
      if (position.overlapsWith(_offset, 0)) {
        String text = annotation.getText();
        if (text != null && text.trim().length() > 0) {
          return new Region(position.offset, position.length);
        }
      }
    }
View Full Code Here

    IDocument document = _viewer.getDocument();
    IAnnotationModel model = _viewer.getAnnotationModel();
    if (model != null) {
      Iterator annotationsIter = model.getAnnotationIterator();
      while (annotationsIter.hasNext()) {
        Annotation annotation = (Annotation) annotationsIter.next();
        Position position = model.getPosition(annotation);
        if (position != null) {
          try {
            int annotationLine = document.getLineOfOffset(position.getOffset());
            if (annotationLine == _line) {
View Full Code Here

//            }
        }
    }

    private static void createAnnotation(IFile file, final IAnnotationModel annotationModel, final String message, final int offset, final int length) {
        Annotation annotation = new DRLProblemAnnotation(message);
        Position position = new Position(0, 1);
//        Position position = new Position(offset, length);
        annotationModel.addAnnotation(annotation, position);
    }
View Full Code Here

    }
   
    public static void removeAnnotationsFor(IAnnotationModel annotationModel) {
        Iterator iterator = annotationModel.getAnnotationIterator();
        while (iterator.hasNext()) {
            Annotation annotation = (Annotation) iterator.next();
            if (annotation instanceof DRLProblemAnnotation) {
                annotationModel.removeAnnotation(annotation);
            }
        }
    }
View Full Code Here

      } catch (Exception e) {
      }
      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;
View Full Code Here

    } catch (Exception e) {
    }
    RutaRule rule = visitor.getResult();
    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);
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.