Examples of IAnnotationModel


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

            log.info(part.getTitle());
        }
        if (part instanceof ITextEditor) {
            final ITextEditor editor = (ITextEditor) part;

            final IAnnotationModel annMod = editor.getDocumentProvider()
                    .getAnnotationModel(editor.getEditorInput());

            @SuppressWarnings("rawtypes")
            final Iterator it = annMod.getAnnotationIterator();

            while (it.hasNext()) {
                final Annotation annotation = (Annotation) it.next();
                if (annotation.getType().equals(CoverageTypes.FULL_COVERAGE)
                        || annotation.getType().equals(CoverageTypes.NO_COVERAGE)) {
                    annMod.removeAnnotation(annotation);
                }
            }
        }
    }
View Full Code Here

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

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

        final IAnnotationModel model = editor.getDocumentProvider().getAnnotationModel(
                editor.getEditorInput());
        final Iterator<Annotation> e = new ErlangAnnotationIterator(model, true, true);
        while (e.hasNext()) {
            final Annotation a = e.next();
            if (a instanceof IErlangAnnotation && ((IErlangAnnotation) a).hasOverlay()
                    || !isNavigationTarget(a)) {
                continue;
            }

            final Position p = model.getPosition(a);
            if (p == null) {
                continue;
            }

            if (forward && p.offset == offset || !forward
View Full Code Here

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

        return false;
    }

    public void markCall() {
        final IDocumentProvider documentProvider = getDocumentProvider();
        final IAnnotationModel annotationModel = documentProvider
                .getAnnotationModel(getEditorInput());

        final ITextSelection pos = (ITextSelection) getSelectionProvider().getSelection();
        final MarkCallLocation location = new MarkCallLocation(getSourceViewer()
                .getDocument(), pos.getStartLine());

        final Position position = new Position(location.getOffset(), location.getLength());
        final String description = location.getDescription();

        final Annotation oldAnnotation = callMatchingLine;
        if (position.getOffset() != 0) {
            callMatchingLine = new Annotation("org.erlide.test_support.trace.call",
                    false, description);
        } else {
            callMatchingLine = null;
        }

        if (annotationModel instanceof IAnnotationModelExtension) {
            final Map<Annotation, Position> annotationMap = new HashMap<Annotation, Position>();
            if (callMatchingLine != null) {
                annotationMap.put(callMatchingLine, position);
            }
            ((IAnnotationModelExtension) annotationModel).replaceAnnotations(
                    new Annotation[] { oldAnnotation }, annotationMap);
        } else {
            annotationModel.addAnnotation(callMatchingLine, position);
        }
    }
View Full Code Here

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

      IDocumentProvider documentProvider = editor.getDocumentProvider();
      if (documentProvider == null)
        return Status.CANCEL_STATUS;

      IAnnotationModel annotationModel = documentProvider
          .getAnnotationModel(editor.getEditorInput());
      if (annotationModel == null)
        return Status.CANCEL_STATUS;

      // Add occurrence annotations
      int length = fPositions.length;

      Map annotationMap = new HashMap(length);
      for (int i = 0; i < length; i++) {
        if (isCanceled())
          return Status.CANCEL_STATUS;

        String message;
        Position position = fPositions[i];

        // Create & add annotation
        try {
          message = document.get(position.offset, position.length);
        } catch (BadLocationException ex) {
          // Skip this match
          continue;
        }

        annotationMap.put(new Annotation(
            "org.eclipse.jdt.ui.occurrences", false, message), //$NON-NLS-1$
            position);
      }

      if (isCanceled())
        return Status.CANCEL_STATUS;

      synchronized (getLockObject(annotationModel)) {
        if (annotationModel instanceof IAnnotationModelExtension) {
          ((IAnnotationModelExtension) annotationModel)
              .replaceAnnotations(fOccurrenceAnnotations,
                  annotationMap);
        } else {
          // removeOccurrenceAnnotations();
          Iterator iter = annotationMap.entrySet().iterator();
          while (iter.hasNext()) {
            Map.Entry mapEntry = (Map.Entry) iter.next();
            annotationModel.addAnnotation(
                (Annotation) mapEntry.getKey(),
                (Position) mapEntry.getValue());
          }
        }
        fOccurrenceAnnotations = (Annotation[]) annotationMap.keySet()
View Full Code Here

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

    IDocumentProvider documentProvider = editor.getDocumentProvider();
    if (documentProvider == null)
      return;

    IAnnotationModel annotationModel = documentProvider
        .getAnnotationModel(editor.getEditorInput());
    if (annotationModel == null || fOccurrenceAnnotations == null)
      return;

    synchronized (getLockObject(annotationModel)) {
      if (annotationModel instanceof IAnnotationModelExtension) {
        ((IAnnotationModelExtension) annotationModel)
            .replaceAnnotations(fOccurrenceAnnotations, null);
      } else {
        for (int i = 0, length = fOccurrenceAnnotations.length; i < length; i++)
          annotationModel.removeAnnotation(fOccurrenceAnnotations[i]);
      }
      fOccurrenceAnnotations = null;
    }
   
   
View Full Code Here

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

   */
  private Map<Object, IStatus> mElementErrorStatus = new HashMap<Object, IStatus>();

  @Override
  protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
    return new IAnnotationModel() {

      private org.apache.uima.caseditor.core.IDocument mDocument;

      public void addAnnotation(Annotation annotation, Position position) {
      }
View Full Code Here

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

        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

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

     */
    public void setDocument( IDocument document )
    {
        if ( sourceViewer.getAnnotationModel() == null )
        {
            IAnnotationModel model = new AnnotationModel();
            sourceViewer.setDocument( sourceViewer.getDocument(), model );
        }

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

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

    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

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

  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
TOP
Copyright © 2018 www.massapi.com. 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.