Codota Logo
IAnnotationModel
Code IndexAdd Codota to your IDE (free)

How to use
IAnnotationModel
in
org.eclipse.jface.text.source

Best Java code snippets using org.eclipse.jface.text.source.IAnnotationModel (Showing top 20 results out of 315)

  • Common ways to obtain IAnnotationModel
private void myMethod () {
IAnnotationModel i =
  • Codota IconISourceViewer viewer;viewer.getAnnotationModel()
  • Codota Iconnew AnnotationModel()
  • Codota IconIDocumentProvider provider;Object element;provider.getAnnotationModel(element)
  • Smart code suggestions by Codota
}
origin: org.eclipse/org.eclipse.ajdt.ui

public Position getPosition(Annotation annotation) {
  if(delegate != null) {
    return delegate.getPosition(annotation);
  } else {
    return null;
  }
}
origin: org.eclipse/org.eclipse.ajdt.ui

public Iterator getAnnotationIterator() {
  if(delegate != null) {
    return delegate.getAnnotationIterator();
  } else {
    return null;
  }
}
origin: org.eclipse.xtext/ui

protected void announceAnnotationChanged(Annotation annotation) {
  if (annotationModel instanceof XtextResourceMarkerAnnotationModel)
    ((XtextResourceMarkerAnnotationModel) annotationModel).fireAnnotationChangedEvent(annotation);
  else {
    Position position = annotationModel.getPosition(annotation);
    if (annotationModel instanceof IAnnotationModelExtension)
      ((IAnnotationModelExtension) annotationModel).modifyAnnotationPosition(annotation, position);
    else {
      annotationModel.removeAnnotation(annotation);
      annotationModel.addAnnotation(annotation, position);
    }
  }
}
origin: angelozerr/jdt-codemining

private void setDiffer(IAnnotationModel differ) {
  if (differ instanceof ILineDiffer || differ == null) {
    if (fLineDiffer != differ) {
      if (fLineDiffer != null)
        ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
      fLineDiffer = (ILineDiffer) differ;
      if (fLineDiffer != null)
        ((IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener);
    }
  }
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public IAnnotationModel removeAnnotationModel(Object key) {
  IAnnotationModel ret= fAttachments.remove(key);
  if (ret != null) {
    for (int i= 0; i < fOpenConnections; i++)
      ret.disconnect(fDocument);
    ret.removeAnnotationModelListener(fModelListener);
  }
  return ret;
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.text

@Override
public void addAnnotationModel(Object key, IAnnotationModel attachment) {
  Assert.isNotNull(attachment);
  if (!fAttachments.containsValue(attachment)) {
    fAttachments.put(key, attachment);
    for (int i= 0; i < fOpenConnections; i++)
      attachment.connect(fDocument);
    attachment.addAnnotationModelListener(fModelListener);
  }
}
origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor

private List<ICompletionProposal> computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) {
  int offset= context.getOffset();
  ArrayList<SpellingProblem> annotationList= new ArrayList<>();
  Iterator<Annotation> iter= model.getAnnotationIterator();
  while (iter.hasNext()) {
    Annotation annotation= iter.next();
    if (canFix(annotation)) {
      Position pos= model.getPosition(annotation);
      if (isAtPosition(offset, pos)) {
        collectSpellingProblems(annotation, annotationList);
      }
    }
  }
  SpellingProblem[] spellingProblems= annotationList.toArray(new SpellingProblem[annotationList.size()]);
  return computeProposals(context, spellingProblems);
}
origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor

  @Override
  public void endCollecting() {
    List<Annotation> toRemove= new ArrayList<>();
    synchronized (fLockObject) {
      Iterator<Annotation> iter= fAnnotationModel.getAnnotationIterator();
      while (iter.hasNext()) {
        Annotation annotation= iter.next();
        if (SpellingAnnotation.TYPE.equals(annotation.getType()))
          toRemove.add(annotation);
      }
      Annotation[] annotationsToRemove= toRemove.toArray(new Annotation[toRemove.size()]);
      if (fAnnotationModel instanceof IAnnotationModelExtension)
        ((IAnnotationModelExtension)fAnnotationModel).replaceAnnotations(annotationsToRemove, fAddAnnotations);
      else {
        for (Annotation element : annotationsToRemove) {
          fAnnotationModel.removeAnnotation(element);
        }
        for (Entry<Annotation, Position> entry : fAddAnnotations.entrySet()) {
          fAnnotationModel.addAnnotation(entry.getKey(), entry.getValue());
        }
      }
    }
    fAddAnnotations= null;
  }
}
origin: org.eclipse.xtext/ui

protected void updateAnnotations(IProgressMonitor monitor, List<Annotation> toBeRemoved,
    Map<Annotation, Position> annotationToPosition) {
  if (monitor.isCanceled()) {
    return;
  }
  if (annotationModel instanceof IAnnotationModelExtension) {
    Annotation[] removedAnnotations = toBeRemoved.toArray(new Annotation[toBeRemoved.size()]);
    ((IAnnotationModelExtension) annotationModel).replaceAnnotations(removedAnnotations, annotationToPosition);
  } else {
    for (Annotation annotation : toBeRemoved) {
      if (monitor.isCanceled()) {
        return;
      }
      annotationModel.removeAnnotation(annotation);
    }
    for (Map.Entry<Annotation, Position> entry : annotationToPosition.entrySet()) {
      if (monitor.isCanceled()) {
        return;
      }
      annotationModel.addAnnotation(entry.getKey(), entry.getValue());
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void removeRangeIndication() {
  if (fRangeIndicator != null && fVisualAnnotationModel != null)
    fVisualAnnotationModel.removeAnnotation(fRangeIndicator);
}
origin: org.eclipse/org.eclipse.ajdt.ui

public void addAnnotation(Annotation annotation, Position position) {
  if(delegate != null) {
    delegate.addAnnotation(annotation, position);
  }
}
origin: org.eclipse/org.eclipse.ajdt.ui

public void disconnect(IDocument document) {
  if(delegate != null) {
    delegate.disconnect(document);
  }
}
origin: org.eclipse/org.eclipse.ajdt.ui

public void connect(IDocument document) {
  if(delegate != null) {
    delegate.connect(document);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Constructs this column with the given arguments.
 *
 * @param model the annotation model to get the annotations from
 * @param width the width of the vertical ruler
 */
public AnnotationRulerColumn(IAnnotationModel model, int width) {
  fWidth= width;
  fAllowSetModel= false;
  fModel= model;
  fModel.addAnnotationModelListener(fInternalListener);
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Disposes of this painter and releases any resources.
 */
private void handleDispose() {
  if (fLineDiffer != null) {
    ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener);
    fLineDiffer= null;
  }
}
origin: org.eclipse/org.eclipse.ui.workbench.texteditor

private List computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) {
  int offset= context.getOffset();
  ArrayList annotationList= new ArrayList();
  Iterator iter= model.getAnnotationIterator();
  while (iter.hasNext()) {
    Annotation annotation= (Annotation)iter.next();
    if (canFix(annotation)) {
      Position pos= model.getPosition(annotation);
      if (isAtPosition(offset, pos)) {
        collectSpellingProblems(annotation, pos, annotationList);
      }
    }
  }
  SpellingProblem[] spellingProblems= (SpellingProblem[]) annotationList.toArray(new SpellingProblem[annotationList.size()]);
  return computeProposals(context, spellingProblems);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void calculateLightBulb(IAnnotationModel model, IInvocationContext context) {
  boolean needsAnnotation= JavaCorrectionProcessor.hasAssists(context);
  if (fIsAnnotationShown) {
    model.removeAnnotation(fAnnotation);
  }
  if (needsAnnotation) {
    model.addAnnotation(fAnnotation, new Position(context.getSelectionOffset(), context.getSelectionLength()));
  }
  fIsAnnotationShown= needsAnnotation;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void removeLightBulb(IAnnotationModel model) {
  synchronized (this) {
    if (fIsAnnotationShown) {
      model.removeAnnotation(fAnnotation);
      fIsAnnotationShown= false;
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void setModel(IAnnotationModel model) {
  if (fAllowSetModel && model != fModel) {
    if (fModel != null)
      fModel.removeAnnotationModelListener(fAnnotationListener);
    fModel= model;
    if (fModel != null)
      fModel.addAnnotationModelListener(fAnnotationListener);
    postRedraw();
  }
}
origin: org.eclipse.pde/org.eclipse.pde.ui

  @Override
  public void endCollecting() {
    synchronized (fLockObject) {
      for (Entry<SpellingAnnotation, Position> entry : fAddAnnotations.entrySet()) {
        fAnnotationModel.addAnnotation(entry.getKey(), entry.getValue());
      }
      deleteNonstringSpellingAnnotations(fAddAnnotations.keySet().iterator());
    }
    fAddAnnotations = null;
  }
}
org.eclipse.jface.text.sourceIAnnotationModel

Javadoc

This interface defines the model for managing annotations attached to a document. The model maintains a set of annotations for a given document and notifies registered annotation model listeners about annotation model changes. It also provides methods for querying the current position of an annotation managed by this model.

In order to provide backward compatibility for clients of IAnnotationModel, extension interfaces are used to provide a means of evolution. The following extension interfaces exist:

  • org.eclipse.jface.text.source.IAnnotationModelExtension since version 3.0 introducing the concept of model piggybacking annotation models, modification time stamps, and enhanced manipulation methods.
  • org.eclipse.jface.text.source.IAnnotationModelExtension2 since version 3.4 allows to retrieve annotations within a given region.

Clients may implement this interface or use the default implementation provided by AnnotationModel.

Most used methods

  • getPosition
    Returns the position associated with the given annotation.
  • getAnnotationIterator
    Returns all annotations managed by this model.
  • addAnnotation
    Adds a annotation to this annotation model. The annotation is associated with with the given positio
  • removeAnnotation
    Removes the given annotation from the model. I.e. the annotation is no longer managed by this model.
  • addAnnotationModelListener
    Registers the annotation model listener with this annotation model. After registration listener is i
  • connect
    Connects the annotation model to a document. The annotations managed by this model must subsequently
  • disconnect
    Disconnects this model from a document. After that, document changes no longer matter. An annotation
  • removeAnnotationModelListener
    Removes the listener from the model's list of annotation model listeners. If the listener is not reg

Popular in Java

  • Making http requests using okhttp
  • getExternalFilesDir (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Reference (javax.naming)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now