- Common ways to obtain IAnnotationModelExtension
private void myMethod () {}
/** * Creates the visual annotation model on top of the given annotation model. * * @param annotationModel the wrapped annotation model * @return the visual annotation model on top of the given annotation model * @since 3.0 */ protected IAnnotationModel createVisualAnnotationModel(IAnnotationModel annotationModel) { IAnnotationModelExtension model= new AnnotationModel(); model.addAnnotationModel(MODEL_ANNOTATION_MODEL, annotationModel); return (IAnnotationModel) model; }
/** * Adds the projection annotation model to the given annotation model. * * @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); } }
/** * Creates the visual annotation model on top of the given annotation model. * * @param annotationModel the wrapped annotation model * @return the visual annotation model on top of the given annotation model * @since 3.0 */ protected IAnnotationModel createVisualAnnotationModel(IAnnotationModel annotationModel) { IAnnotationModelExtension model= new AnnotationModel(); model.addAnnotationModel(MODEL_ANNOTATION_MODEL, annotationModel); return (IAnnotationModel) model; }
/** * Adds the projection annotation model to the given annotation model. * * @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); } }
/** * Creates the visual annotation model on top of the given annotation model. * * @param annotationModel the wrapped annotation model * @return the visual annotation model on top of the given annotation model * @since 3.0 */ @SuppressWarnings("static-method") protected IAnnotationModel createVisualAnnotationModel(IAnnotationModel annotationModel) { IAnnotationModelExtension model= new AnnotationModel(); model.addAnnotationModel(MODEL_ANNOTATION_MODEL, annotationModel); return (IAnnotationModel) model; }
public RevisionInformation getRevisionInformation(IResource resource, ITextViewer viewer, ITextEditor textEditor) { for (IRevisionInformationProvider provider : providers) { if (provider.canApply(resource)) { RevisionInformation info = provider.getRevisionInformation(resource); if (info != null) { ILineDiffer differ = provider.getDocumentLineDiffer(viewer, textEditor); // Connect line differ IAnnotationModelExtension ext = (IAnnotationModelExtension) ((ISourceViewer) viewer).getAnnotationModel(); ext.addAnnotationModel(RevisionInformationSupport.MY_QUICK_DIFF_MODEL_ID, (IAnnotationModel) differ); return info; } } } return null; }
private void ensureAnnotationModelInstalled() { LinkedPositionAnnotations lpa= fCurrentTarget.fAnnotationModel; if (lpa != null) { 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); } } } } }
private void ensureAnnotationModelInstalled() { LinkedPositionAnnotations lpa= fCurrentTarget.fAnnotationModel; if (lpa != null) { 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); } } } } }
model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
modelExtension.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, newDiffer);
modelExtension.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, newDiffer);
if (model == null) model= new AnnotationModel(); model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);
if (model == null) model= new AnnotationModel(); model.addAnnotationModel(IChangeRulerColumn.QUICK_DIFF_MODEL_ID, differ);