private void findJavaAnnotation() {
    fPosition = null;
    fAnnotation = null;
    fHasCorrection = false;

    AbstractMarkerAnnotationModel model = getAnnotationModel();
    IAnnotationAccessExtension annotationAccess = getAnnotationAccessExtension();

    IDocument document = getDocument();
    if (model == null) return;

    boolean hasAssistLightbulb =
        fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);

    Iterator iter = model.getAnnotationIterator();
    int layer = Integer.MIN_VALUE;

    while (iter.hasNext()) {
      Annotation annotation = (Annotation) iter.next();
      if (annotation.isMarkedDeleted()) continue;

      int annotationLayer = layer;
      if (annotationAccess != null) {
        annotationLayer = annotationAccess.getLayer(annotation);
        if (annotationLayer < layer) continue;
      }

      Position position = model.getPosition(annotation);
      if (!includesRulerLine(position, document)) continue;

      boolean isReadOnly =
          fTextEditor instanceof ITextEditorExtension
              && ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly();
      if (!isReadOnly
          && (((hasAssistLightbulb && annotation instanceof AssistAnnotation)
              || JavaCorrectionProcessor.hasCorrections(annotation)))) {
        fPosition = position;
        fAnnotation = annotation;
        fHasCorrection = true;
        layer = annotationLayer;
        continue;
      } else if (!fHasCorrection) {
        AnnotationPreference preference =
            fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
        if (preference == null) continue;

        String key = preference.getVerticalRulerPreferenceKey();
        if (key == null) continue;

        if (fStore.getBoolean(key)) {
          fPosition = position;
          fAnnotation = annotation;
          layer = annotationLayer;
        }
      }
    }
  }
    private void initialize() {
      final IPreferenceStore store = EditorsUI.getPreferenceStore();
      if (store == null) {
        return;
      }

      AnnotationPreferenceLookup lookup = EditorsUI.getAnnotationPreferenceLookup();
      final AnnotationPreference commentedPref =
          lookup.getAnnotationPreference(CommentAnnotation.COMMENT_ANNOTATION_ID);

      updateCommentedColor(commentedPref, store);

      fDispatcher = new PropertyEventDispatcher(store);

      if (commentedPref != null) {
        fDispatcher.addPropertyChangeListener(
            commentedPref.getColorPreferenceKey(),
            new IPropertyChangeListener() {
              public void propertyChange(PropertyChangeEvent event) {
                updateCommentedColor(commentedPref, store);
              }
            });
      }
    }
    private void findAnnotation() {
      mPosition = null;
      mCanFix = false;

      IDocumentProvider provider = mTextEditor.getDocumentProvider();
      IAnnotationModel model = provider.getAnnotationModel(mTextEditor.getEditorInput());
      IAnnotationAccessExtension annotationAccess = getAnnotationAccessExtension();

      IDocument document = getDocument();
      if (model == null) {
        return;
      }

      Iterator<?> iter = model.getAnnotationIterator();
      int layer = Integer.MIN_VALUE;

      while (iter.hasNext()) {
        Annotation annotation = (Annotation) iter.next();
        if (annotation.isMarkedDeleted()) {
          continue;
        }

        int annotationLayer = Integer.MAX_VALUE;
        if (annotationAccess != null) {
          annotationLayer = annotationAccess.getLayer(annotation);
          if (annotationLayer < layer) {
            continue;
          }
        }

        Position position = model.getPosition(annotation);
        if (!includesRulerLine(position, document)) {
          continue;
        }

        boolean isReadOnly =
            mTextEditor instanceof ITextEditorExtension
                && ((ITextEditorExtension) mTextEditor).isEditorInputReadOnly();
        if (!isReadOnly
            && annotation instanceof INIProblemAnnotation
            && ((INIProblemAnnotation) annotation).isQuickFixable()) {
          mPosition = position;
          mCanFix = true;
          layer = annotationLayer;
          continue;
        } else {
          AnnotationPreference preference =
              mAnnotationPreferenceLookup.getAnnotationPreference(annotation);
          if (preference == null) {
            continue;
          }

          String key = preference.getVerticalRulerPreferenceKey();
          if (key == null) {
            continue;
          }

          if (mStore.getBoolean(key)) {
            mPosition = position;
            mCanFix = false;
            layer = annotationLayer;
          }
        }
      }
    }
  /*
   * @see org.eclipse.ui.internal.texteditor.AnnotationExpandHover#getHoverInfoForLine(org.eclipse.jface.text.source.ISourceViewer, int)
   */
  @Override
  protected Object getHoverInfoForLine(final ISourceViewer viewer, final int line) {
    final boolean showTemporaryProblems =
        PreferenceConstants.getPreferenceStore()
            .getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
    IAnnotationModel model = viewer.getAnnotationModel();
    IDocument document = viewer.getDocument();

    if (model == null) return null;

    List<Annotation> exact = new ArrayList<Annotation>();
    HashMap<Position, Object> messagesAtPosition = new HashMap<Position, Object>();

    Iterator<Annotation> e = model.getAnnotationIterator();
    while (e.hasNext()) {
      Annotation annotation = e.next();

      if (fAnnotationAccess instanceof IAnnotationAccessExtension)
        if (!((IAnnotationAccessExtension) fAnnotationAccess).isPaintable(annotation)) continue;

      if (annotation instanceof IJavaAnnotation
          && !isIncluded((IJavaAnnotation) annotation, showTemporaryProblems)) continue;

      AnnotationPreference pref = fLookup.getAnnotationPreference(annotation);
      if (pref != null) {
        String key = pref.getVerticalRulerPreferenceKey();
        if (key != null && !fStore.getBoolean(key)) continue;
      }

      Position position = model.getPosition(annotation);
      if (position == null) continue;

      if (compareRulerLine(position, document, line) == 1) {

        if (isDuplicateMessage(messagesAtPosition, position, annotation.getText())) continue;

        exact.add(annotation);
      }
    }

    sort(exact, model);

    if (exact.size() > 0) setLastRulerMouseLocation(viewer, line);

    if (exact.size() > 0) {
      Annotation first = exact.get(0);
      if (!isBreakpointAnnotation(first)) exact.add(0, new NoBreakpointAnnotation());
    }

    if (exact.size() <= 1) return null;

    AnnotationHoverInput input = new AnnotationHoverInput();
    input.fAnnotations = exact.toArray(new Annotation[0]);
    input.fViewer = viewer;
    input.fRulerInfo = fCompositeRuler;
    input.fAnnotationListener = fgListener;
    input.fDoubleClickListener = fDblClickListener;
    input.redoAction =
        new AnnotationExpansionControl.ICallback() {

          public void run(IInformationControlExtension2 control) {
            control.setInput(getHoverInfoForLine(viewer, line));
          }
        };
    input.model = model;

    return input;
  }