예제 #1
0
 /*
  * @see ISourceViewer#getAnnotationModel()
  */
 public IAnnotationModel getAnnotationModel() {
   if (fVisualAnnotationModel instanceof IAnnotationModelExtension) {
     IAnnotationModelExtension extension = (IAnnotationModelExtension) fVisualAnnotationModel;
     return extension.getAnnotationModel(MODEL_ANNOTATION_MODEL);
   }
   return null;
 }
예제 #2
0
  /*
   * @see ISourceViewer#setRangeIndication(int, int, boolean)
   */
  public void setRangeIndication(int start, int length, boolean moveCursor) {

    if (moveCursor) {
      setSelectedRange(start, 0);
      revealRange(start, length);
    }

    if (fRangeIndicator != null && fVisualAnnotationModel instanceof IAnnotationModelExtension) {
      IAnnotationModelExtension extension = (IAnnotationModelExtension) fVisualAnnotationModel;
      extension.modifyAnnotationPosition(fRangeIndicator, new Position(start, length));
    }
  }
예제 #3
0
  /**
   * Disposes the visual annotation model.
   *
   * @since 3.1
   */
  protected void disposeVisualAnnotationModel() {
    if (fVisualAnnotationModel != null) {
      if (getDocument() != null) fVisualAnnotationModel.disconnect(getDocument());

      if (fVisualAnnotationModel instanceof IAnnotationModelExtension)
        ((IAnnotationModelExtension) fVisualAnnotationModel)
            .removeAnnotationModel(MODEL_ANNOTATION_MODEL);

      fVisualAnnotationModel = null;
    }
  }
예제 #4
0
 /**
  * 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;
 }