Examples of IAnnotationModelExtension


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

      CompilerFacade compilerFacade = new CompilerFacade();
      CategorizedProblem[] validate = compilerFacade.validate(
          document.get(), editor.getJavaProject());
      IAnnotationModel annotationModel = editor.getViewer()
          .getAnnotationModel();
      IAnnotationModelExtension e = (IAnnotationModelExtension) annotationModel;
      e.removeAllAnnotations();
      if (validate != null) {
        for (CategorizedProblem p : validate) {
          if (p.isError()){
          int length = p.getSourceEnd() - p.getSourceStart()+1;
          try{
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

  private boolean isCanceled(IProgressMonitor monitor) {
    return monitor != null && monitor.isCanceled();
  }

  private void removeSummaries(IProgressMonitor monitor) {
    IAnnotationModelExtension extension= null;
    List bags= null;

    if (fAnnotationModel instanceof IAnnotationModelExtension) {
      extension= (IAnnotationModelExtension) fAnnotationModel;
      bags= new ArrayList();
    }

    Iterator e= fAnnotationModel.getAnnotationIterator();
    while (e.hasNext()) {
      Annotation annotation= (Annotation) e.next();
      if (annotation instanceof AnnotationBag) {
        if (bags == null)
          fAnnotationModel.removeAnnotation(annotation);
        else
          bags.add(annotation);
      }

      if (isCanceled(monitor))
        return;
    }

    if (bags != null && bags.size() > 0) {
      Annotation[] deletions= new Annotation[bags.size()];
      bags.toArray(deletions);
      if (!isCanceled(monitor))
        extension.replaceAnnotations(deletions, null);
    }
  }
View Full Code Here

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

        return;
    }

    if (additions.size() > 0) {
      if (fAnnotationModel instanceof IAnnotationModelExtension) {
        IAnnotationModelExtension extension= (IAnnotationModelExtension) fAnnotationModel;
        if (!isCanceled(monitor))
          extension.replaceAnnotations(null, additions);
      } else {
        Iterator e1= additions.keySet().iterator();
        while (e1.hasNext()) {
          AnnotationBag bag= (AnnotationBag) e1.next();
          Position position= (Position) additions.get(bag);
View Full Code Here

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

      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

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

    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

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

    IAnnotationModel model= null;
    if (viewer instanceof ISourceViewerExtension2) {
      ISourceViewerExtension2 viewerExtension= (ISourceViewerExtension2) viewer;
      IAnnotationModel visual= viewerExtension.getVisualAnnotationModel();
      if (visual instanceof IAnnotationModelExtension) {
        IAnnotationModelExtension modelExtension= (IAnnotationModelExtension) visual;
        model= modelExtension.getAnnotationModel(ProjectionSupport.PROJECTION);
      }
    }

    if (model != null) {
      try {
View Full Code Here

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

   *
   * @param model the model to which the projection annotation model is added
   */
  private void addProjectionAnnotationModel(IAnnotationModel model) {
    if (model instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension extension= (IAnnotationModelExtension) model;
      extension.addAnnotationModel(ProjectionSupport.PROJECTION, fProjectionAnnotationModel);
      model.addAnnotationModelListener(fAnnotationModelListener);
    }
  }
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.