Package org.eclipse.jface.text.source

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


              FoldingAnnotation annotation = new FoldingAnnotation(indexedRegion, false);
             
              // if INSERT calculate new addition position or modification
              // else if REMOVE add annotation to the deletion list
              if(isInsert) {
                Annotation existingAnno = getExistingAnnotation(indexedRegion);
                //if projection has been disabled the iter could be null
                //if annotation does not already exist for this region create a new one
                //else modify an old one, which could include deletion
                if(existingAnno == null) {
                  Position newPos = calcNewFoldPosition(indexedRegion);
View Full Code Here


   */
  protected void markInvalidAnnotationsForDeletion(DirtyRegion dirtyRegion, List deletions) {
    Iterator iter = getAnnotationIterator(dirtyRegion);
    if (iter != null) {
      while(iter.hasNext()) {
        Annotation anno = (Annotation)iter.next();
        if(anno instanceof FoldingAnnotation) {
          Position pos = fProjectionAnnotationModel.getPosition(anno);
          if(pos.length == 0) {
            deletions.add(anno);
           }
View Full Code Here

   * @param indexedRegion get the first {@link Annotation} at this {@link IndexedRegion}
   * @return the first {@link Annotation} at the start offset of the given {@link IndexedRegion}
   */
  private Annotation getExistingAnnotation(IndexedRegion indexedRegion) {
    Iterator iter = fProjectionAnnotationModel.getAnnotationIterator(indexedRegion.getStartOffset(), 1, false, true);
    Annotation anno = null;
    if(iter.hasNext()) {
      anno = (Annotation)iter.next();
    }

    return anno;
View Full Code Here

   * @param annotationPosition
   *            the position of the found annotation
   * @return the found annotation
   */
  protected Annotation getNextAnnotation(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 = getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput());
    int endOfDocument = document.getLength();
    int distance = Integer.MAX_VALUE;

    IAnnotationModel model = getTextEditor().getDocumentProvider().getAnnotationModel(getTextEditor().getEditorInput());
    // external files may not have an annotation model
    if (model != null) {
      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

    if (false /* delayed - see bug 18316 */) {
      getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
      getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
    }
    else /* no delay - see bug 18316 */{
      Annotation annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
      IEditorStatusLine editorStatusLine = (IEditorStatusLine) getTextEditor().getAdapter(IEditorStatusLine.class);
      if (editorStatusLine != null) {
        editorStatusLine.setMessage(true, null, null);
        editorStatusLine.setMessage(false, null, null);
      }
      else {
        IStatusLineManager mgr = getStatusLineManager();
        if (mgr != null) {
          mgr.setErrorMessage(null);
          mgr.setMessage(null, null);
        }
      }
      if (annotation != null) {
        updateAnnotationViews(annotation);
        if (_debug) {
          System.out.println("select and reveal " + annotation.getType() + "@" + position.getOffset() + ":" + position.getLength()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
        if (editorStatusLine != null) {
          editorStatusLine.setMessage(true, null, null);
          editorStatusLine.setMessage(false, annotation.getText(), null);
        }
        else {
          IStatusLineManager mgr = getStatusLineManager();
          if (mgr != null) {
            mgr.setErrorMessage(null);
            mgr.setMessage(null, annotation.getText());
          }
          getTextEditor().getSelectionProvider().addSelectionChangedListener(new StatusLineClearer(mgr));
        }
      }
    }
View Full Code Here

    List allProposals = new ArrayList();
    if (model instanceof IAnnotationModelExtension2) {
      Iterator iter = ((IAnnotationModelExtension2) model).getAnnotationIterator(documentOffset, length, true, true);
      while (iter.hasNext()) {
        List processors = new ArrayList();
        Annotation anno = (Annotation) iter.next();
        if (canFix(anno)) {
          // first check to see if annotation already has a quick
          // fix processor attached to it
          if (anno instanceof TemporaryAnnotation) {
            Object o = ((TemporaryAnnotation) anno).getAdditionalFixInfo();
View Full Code Here

              FoldingAnnotation annotation = new FoldingAnnotation(indexedRegion, false);
             
              // if INSERT calculate new addition position or modification
              // else if REMOVE add annotation to the deletion list
              if(isInsert) {
                Annotation existingAnno = getExistingAnnotation(indexedRegion);
                //if projection has been disabled the iter could be null
                //if annotation does not already exist for this region create a new one
                //else modify an old one, which could include deletion
                if(existingAnno == null) {
                  Position newPos = calcNewFoldPosition(indexedRegion);
View Full Code Here

   * newly found invalid {@link FoldingAnnotation}s will be added to
   */
  protected void markInvalidAnnotationsForDeletion(DirtyRegion dirtyRegion, List deletions) {
    Iterator iter = getAnnotationIterator(dirtyRegion);
    while(iter.hasNext()) {
      Annotation anno = (Annotation)iter.next();
      if(anno instanceof FoldingAnnotation) {
        Position pos = fProjectionAnnotationModel.getPosition(anno);
        if(pos.length == 0) {
          deletions.add(anno);
         }
View Full Code Here

   * @param indexedRegion get the first {@link Annotation} at this {@link IndexedRegion}
   * @return the first {@link Annotation} at the start offset of the given {@link IndexedRegion}
   */
  private Annotation getExistingAnnotation(IndexedRegion indexedRegion) {
    Iterator iter = fProjectionAnnotationModel.getAnnotationIterator(indexedRegion.getStartOffset(), 1, false, true);
    Annotation anno = null;
    if(iter.hasNext()) {
      anno = (Annotation)iter.next();
    }

    return anno;
View Full Code Here

        for (CategorizedProblem p : validate) {
          if (p.isError()){
          int length = p.getSourceEnd() - p.getSourceStart()+1;
          try{
          Position pa = new Position(p.getSourceStart()-compilerFacade.length,length);
          annotationModel.addAnnotation(new Annotation(
              "org.eclipse.ui.workbench.texteditor.spelling",
              false, p.getMessage()), pa);
          }catch (Exception ea) {
          }
          }
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.