Examples of IAnnotationModelExtension


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

        mFeatureStructureSelectionProvider.clearSelectionSilently();
      }

      highlight(0, 0); // TODO: only if removed annotation was selected

      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      Annotation removeAnnotations[] = new Annotation[deletedAnnotations.size()];
      int removeAnnotationsIndex = 0;
      for (AnnotationFS annotation : deletedAnnotations) {
        removeAnnotations[removeAnnotationsIndex++] = new EclipseAnnotationPeer(annotation);
      }
     
      annotationModel.replaceAnnotations(removeAnnotations, null);
    }
View Full Code Here

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

     *
     * @param annotations
     */
    @Override
    public void addedAnnotation(Collection<AnnotationFS> annotations) {
      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      Map<Annotation, Position> addAnnotationMap = new HashMap<Annotation, Position>();
     
      for (AnnotationFS annotation : annotations) {
        addAnnotationMap.put(new EclipseAnnotationPeer(annotation), new Position(annotation.getBegin(),
                annotation.getEnd() - annotation.getBegin()));
      }
     
      annotationModel.replaceAnnotations(null, addAnnotationMap);
    }
View Full Code Here

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

        mFeatureStructureSelectionProvider.clearSelectionSilently();
      }

      highlight(0, 0); // TODO: only if removed annotation was selected

      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      Annotation removeAnnotations[] = new Annotation[deletedAnnotations.size()];
      int removeAnnotationsIndex = 0;
      for (AnnotationFS annotation : deletedAnnotations) {
        removeAnnotations[removeAnnotationsIndex++] = new EclipseAnnotationPeer(annotation);
      }
     
      annotationModel.replaceAnnotations(removeAnnotations, null);
    }
View Full Code Here

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

     * @param annotations
     */
    @Override
    public void updatedAnnotation(Collection<AnnotationFS> annotations) {
     
      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      for (AnnotationFS annotation : annotations) {
        annotationModel.modifyAnnotationPosition(new EclipseAnnotationPeer(annotation),
                new Position(annotation.getBegin(), annotation.getEnd() - annotation.getBegin()));
      }
     
      selectionChanged(getSite().getPage().getActivePart(), mFeatureStructureSelectionProvider.getSelection());
    }
View Full Code Here

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

    if (model == null)
      return;

    if (model instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension modelExt = (IAnnotationModelExtension) model;
      Annotation[] oldAnnotations = fAnnotations
          .toArray(new Annotation[fAnnotations.size()]);

      modelExt.replaceAnnotations(oldAnnotations, Collections.EMPTY_MAP);
    } else {
      for (Iterator i = model.getAnnotationIterator(); i.hasNext();) {
        Annotation a = (Annotation) i.next();

        if (a.getType().equals(fAnnotationType)) {
View Full Code Here

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

   */
  public void endMessages() {
    IAnnotationModel model = fEditor.getDocumentProvider()
        .getAnnotationModel(fEditor.getEditorInput());
    if (model instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension modelExt = (IAnnotationModelExtension) model;
      Annotation[] oldAnnotations = fAnnotations
          .toArray(new Annotation[fAnnotations.size()]);
      Map<Annotation, Position> newAnnotations = new HashMap<Annotation, Position>(
          fMessages.size());
      for (PositionedMessage pm : fMessages) {
        Annotation anno = new Annotation(fAnnotationType, false,
            pm.message);
        newAnnotations.put(anno, pm.pos);
        fAnnotations.add(anno);
      }
      modelExt.replaceAnnotations(oldAnnotations, newAnnotations);
    } else {
      for (Iterator i = model.getAnnotationIterator(); i.hasNext();) {
        Annotation a = (Annotation) i.next();

        if (a.getType().equals(fAnnotationType)) {
View Full Code Here

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

            }
        }

        // Remove collected annotations.
        if (model instanceof IAnnotationModelExtension) {
            IAnnotationModelExtension extension = (IAnnotationModelExtension) model;
            extension.replaceAnnotations(
                annotations.toArray(new Annotation[annotations.size()]),
                Collections.emptyMap());
        } else {
            if (!errorPrinted) {
                log.error("AnnotationModel does not "
View Full Code Here

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

            if (oldAnnotation.getSource().equals(source)) {
                // If model supports IAnnotationModelExtension we can
                // just update the existing annotation.
                if (newAnnotation != null
                    && model instanceof IAnnotationModelExtension) {
                    IAnnotationModelExtension extension = (IAnnotationModelExtension) model;
                    extension.replaceAnnotations(
                        new Annotation[] { oldAnnotation },
                        Collections.singletonMap(newAnnotation, position));
                    return;
                }
                model.removeAnnotation(annotation);
View Full Code Here

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

    annotationsToAdd = fProblemCollector.getAnnotations();
    fProblemCollector.clear();


    if (annotationModel instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension modelExtension = (IAnnotationModelExtension) annotationModel;
      Map annotationsToAddMap = new HashMap();
      for (int i = 0; i < annotationsToAdd.length; i++) {
        annotationsToAddMap.put(annotationsToAdd[i], ((TemporaryAnnotation) annotationsToAdd[i]).getPosition());
      }
      modelExtension.replaceAnnotations(annotationsToRemove, annotationsToAddMap);
    }

    else {
      for (int j = 0; j < annotationsToAdd.length; j++) {
        annotationModel.addAnnotation(annotationsToAdd[j], ((TemporaryAnnotation) annotationsToAdd[j]).getPosition());
View Full Code Here

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

    annotationsToAdd = fProblemCollector.getAnnotations();
    fProblemCollector.clear();


    if (annotationModel instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension modelExtension = (IAnnotationModelExtension) annotationModel;
      Map annotationsToAddMap = new HashMap();
      for (int i = 0; i < annotationsToAdd.length; i++) {
        annotationsToAddMap.put(annotationsToAdd[i], ((TemporaryAnnotation) annotationsToAdd[i]).getPosition());
      }
      modelExtension.replaceAnnotations(annotationsToRemove, annotationsToAddMap);
    }

    else {
      for (int j = 0; j < annotationsToAdd.length; j++) {
        annotationModel.addAnnotation(annotationsToAdd[j], ((TemporaryAnnotation) annotationsToAdd[j]).getPosition());
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.