Package org.eclipse.jface.text.source

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


 
 
 
 
  private List<Annotation> getAnnotations(ISourceViewer viewer, int lineNumber) {
    IAnnotationModel model= viewer.getAnnotationModel();
    IDocument document= viewer.getDocument();
    return getAnnotationsAtLine(model, document, lineNumber);
    }
View Full Code Here


        ISourceViewer viewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class );
        if ( viewer == null )
            return;

        IDocument document = viewer.getDocument();
        IAnnotationModel annotationModel = viewer.getAnnotationModel();
        if ( document == null || annotationModel == null || model == null )
            return;

        if ( annotationModel instanceof IAnnotationModelExtension )
        {
View Full Code Here

    {
        this.document = document;

        if ( this.sourceViewer.getAnnotationModel() == null )
        {
            IAnnotationModel model = new AnnotationModel();
            this.sourceViewer.setDocument( this.sourceViewer.getDocument(), model );
        }

        // add annotation painter
        if ( this.paintManager == null && this.sourceViewer.getAnnotationModel() instanceof IAnnotationModelExtension )
View Full Code Here

    mPainter.paint(IPainter.CONFIGURATION);
  }

  private void removeAllAnnotations() {
    // Remove all annotation from the model
    IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel(getEditorInput());
    ((IAnnotationModelExtension) annotationModel).removeAllAnnotations();
  }
View Full Code Here

  private void syncAnnotations() {
   
    removeAllAnnotations();
   
    // Remove all annotation from the model
    IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel(getEditorInput());
    ((IAnnotationModelExtension) annotationModel).removeAllAnnotations();
   
    // Add all annotation to the model
    // copy annotations into annotation model
    final Iterator<AnnotationFS> mAnnotations = getDocument().getCAS().getAnnotationIndex()
View Full Code Here

      if (DEBUG) {
        System.out.println("no document provider"); //$NON-NLS-1$
      }
      return;
    }
    IAnnotationModel annotationModel = documentProvider.getAnnotationModel(textEditor.getEditorInput());
    if (annotationModel == null) {
      if (DEBUG) {
        System.out.println("no annotation model"); //$NON-NLS-1$
      }
      return;
    }

    Iterator annotationIterator = annotationModel.getAnnotationIterator();
    List oldAnnotations = new ArrayList();
    while (annotationIterator.hasNext()) {
      Annotation annotation = (Annotation) annotationIterator.next();
      if (ANNOTATION_TYPE.equals(annotation.getType())) {
        annotation.markDeleted(true);
        /**
         * Sometimes it is supported, sometime's it is not. Confusing.
         */
        try {
          annotationIterator.remove();
        }
        catch (UnsupportedOperationException e) {
          oldAnnotations.add(annotation);
        }
        if (DEBUG) {
          System.out.println("removed " + annotation); //$NON-NLS-1$
        }
        if (!allMatching)
          break;
      }
    }
    if (!oldAnnotations.isEmpty()) {
      int size = oldAnnotations.size();
      for (int i = 0; i < size; i++) {
        annotationModel.removeAnnotation((Annotation) oldAnnotations.get(i));
      }
    }
  }
View Full Code Here

      if (DEBUG) {
        System.out.println("no document provider"); //$NON-NLS-1$
      }
      return;
    }
    IAnnotationModel annotationModel = documentProvider.getAnnotationModel(textEditor.getEditorInput());
    if (annotationModel == null || !(annotationModel instanceof IAnnotationModelExtension)) {
      if (DEBUG) {
        System.out.println("no annotation model"); //$NON-NLS-1$
      }
      return;
    }

    List oldAnnotations = new ArrayList(2);
    Iterator annotationIterator = annotationModel.getAnnotationIterator();
    while (annotationIterator.hasNext()) {
      Annotation annotation = (Annotation) annotationIterator.next();
      if (ANNOTATION_TYPE.equals(annotation.getType())) {
        annotation.markDeleted(true);
        if (DEBUG) {
View Full Code Here

    }

    if (map == null)
      return;

    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

    LinkedPositionAnnotations lpa= fCurrentTarget.fAnnotationModel;
    if (lpa != null) {
      ITextViewer viewer= fCurrentTarget.getViewer();
      if (viewer instanceof ISourceViewer) {
        ISourceViewer sv= (ISourceViewer) viewer;
        IAnnotationModel model= sv.getAnnotationModel();
        if (model instanceof IAnnotationModelExtension) {
          IAnnotationModelExtension ext= (IAnnotationModelExtension) model;
          IAnnotationModel ourModel= ext.getAnnotationModel(getUniqueKey());
          if (ourModel == null) {
            ext.addAnnotationModel(getUniqueKey(), lpa);
          }
        }
      }
View Full Code Here

  private void uninstallAnnotationModel(LinkedModeUITarget target) {
    ITextViewer viewer= target.getViewer();
    if (viewer instanceof ISourceViewer) {
      ISourceViewer sv= (ISourceViewer) viewer;
      IAnnotationModel model= sv.getAnnotationModel();
      if (model instanceof IAnnotationModelExtension) {
        IAnnotationModelExtension ext= (IAnnotationModelExtension) model;
        ext.removeAnnotationModel(getUniqueKey());
      }
    }
View Full Code Here

TOP

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

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.