Examples of IAnnotationModel


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

   * Creates a new spelling problem collector.
   *
   * @return the collector or <code>null</code> if none is available
   */
  protected ISpellingProblemCollector createSpellingProblemCollector() {
    IAnnotationModel model= getAnnotationModel();
    if (model == null)
      return null;
    return new SpellingProblemCollector(model);
  }
View Full Code Here

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

    int end= MarkerUtilities.getCharEnd(marker);
   
    boolean selectLine= start < 0 || end < 0;

    // look up the current range of the marker when the document has been edited
    IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
    if (model instanceof AbstractMarkerAnnotationModel) {

      AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) model;
      Position pos= markerModel.getMarkerPosition(marker);
      if (pos != null && !pos.isDeleted()) {
View Full Code Here

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

    IDocumentProvider documentProvider= fTextEditor.getDocumentProvider();
    IEditorInput editorInput= fTextEditor.getEditorInput();
   
    // look up the current range of the marker when the document has been edited
    IAnnotationModel model= documentProvider.getAnnotationModel(editorInput);
    if (model instanceof AbstractMarkerAnnotationModel) {

      AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) model;
      Position pos= markerModel.getMarkerPosition(marker);
      if (pos != null && !pos.isDeleted()) {
View Full Code Here

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

   *
   * @return the marker annotation model or <code>null</code> if there's none
   */
  protected AbstractMarkerAnnotationModel getAnnotationModel() {
    IDocumentProvider provider= fTextEditor.getDocumentProvider();
    IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput());
    if (model instanceof AbstractMarkerAnnotationModel)
      return (AbstractMarkerAnnotationModel) model;
    return null;
  }
View Full Code Here

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

    return document.getLineInformationOfOffset(invocationLocation);
  }

  public static int collectQuickFixableAnnotations(ITextEditor editor, int invocationLocation,
          boolean goToClosest, ArrayList resultingAnnotations) throws BadLocationException {
    IAnnotationModel model = DLTKUIPlugin.getDocumentProvider().getAnnotationModel(
            editor.getEditorInput());
    if (model == null) {
      return invocationLocation;
    }

    ensureUpdatedAnnotations(editor);

    Iterator iter = model.getAnnotationIterator();
    if (goToClosest) {
      IRegion lineInfo = getRegionOfInterest(editor, invocationLocation);
      if (lineInfo == null) {
        return invocationLocation;
      }
      int rangeStart = lineInfo.getOffset();
      int rangeEnd = rangeStart + lineInfo.getLength();

      ArrayList allAnnotations = new ArrayList();
      ArrayList allPositions = new ArrayList();
      int bestOffset = Integer.MAX_VALUE;
      while (iter.hasNext()) {
        Annotation annot = (Annotation) iter.next();
        if (RutaCorrectionProcessor.isQuickFixableType(annot)) {
          Position pos = model.getPosition(annot);
          if (pos != null && isInside(pos.offset, rangeStart, rangeEnd)) { // inside
            // our
            // range?
            allAnnotations.add(annot);
            allPositions.add(pos);
            bestOffset = processAnnotation(annot, pos, invocationLocation, bestOffset);
          }
        }
      }
      if (bestOffset == Integer.MAX_VALUE) {
        return invocationLocation;
      }
      for (int i = 0; i < allPositions.size(); i++) {
        Position pos = (Position) allPositions.get(i);
        if (isInside(bestOffset, pos.offset, pos.offset + pos.length)) {
          resultingAnnotations.add(allAnnotations.get(i));
        }
      }
      return bestOffset;
    } else {
      while (iter.hasNext()) {
        Annotation annot = (Annotation) iter.next();
        if (RutaCorrectionProcessor.isQuickFixableType(annot)) {
          Position pos = model.getPosition(annot);
          if (pos != null && isInside(invocationLocation, pos.offset, pos.offset + pos.length)) {
            resultingAnnotations.add(annot);
          }
        }
      }
View Full Code Here

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

  public ICompletionProposal[] computeQuickAssistProposals(
          IQuickAssistInvocationContext invocationContext) {
    final Annotation[] annotations = fAssistant.getAnnotationsAtOffset();
    final ScriptEditor editor = (ScriptEditor) this.fAssistant.getEditor();
    final IAnnotationModel model = DLTKUIPlugin.getDocumentProvider().getAnnotationModel(
            editor.getEditorInput());
    final IModelElement element = editor.getInputModelElement();
    final IScriptProject scriptProject = element.getScriptProject();
    List proposals = null;
    for (int i = 0; i < annotations.length; i++) {
View Full Code Here

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

    }
    addAnnotations(myAnnotations);
  }

  private void removeAnnotations(Collection<Annotation> annotations) {
    IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
    for (Annotation annotation : annotations) {
      model.removeAnnotation(annotation);
    }
  }
View Full Code Here

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

      model.removeAnnotation(annotation);
    }
  }

  private void addAnnotations(Map<Annotation, Position> annotationToPositionMap) {
    IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
    for (Annotation a : annotationToPositionMap.keySet()) {
      Position p = annotationToPositionMap.get(a);
      model.addAnnotation(a, p);
    }
  }
View Full Code Here

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

    mPainter.paint(IPainter.CONFIGURATION);
  }

  private void syncAnnotations() {
    // 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 = mDocument.getCAS().getAnnotationIndex()
            .iterator();

    while (mAnnotations.hasNext()) {
      AnnotationFS annotationFS = mAnnotations.next();
      annotationModel.addAnnotation(new EclipseAnnotationPeer(annotationFS), new Position(
              annotationFS.getBegin(), annotationFS.getEnd() - annotationFS.getBegin()));
    }
  }
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
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.