@Override
  public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {

    if (annotation instanceof IAnnotationPresentation) {
      IAnnotationPresentation presentation = (IAnnotationPresentation) annotation;
      presentation.paint(gc, canvas, bounds);
      return;
    }

    AnnotationPreference preference = getAnnotationPreference(annotation);
    if (preference != null) {
      Object type = getType(annotation);
      String annotationType = (type == null ? null : type.toString());
      Image image = getImage(annotation, preference, annotationType);
      if (image != null) {
        ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
        return;
      }
    }

    // backward compatibility, ignore exceptions, just don't paint
    try {

      Method method =
          annotation
              .getClass()
              .getMethod(
                  "paint", new Class[] {GC.class, Canvas.class, Rectangle.class}); // $NON-NLS-1$
      method.invoke(annotation, new Object[] {gc, canvas, bounds});

    } catch (SecurityException x) {
    } catch (IllegalArgumentException x) {
    } catch (NoSuchMethodException x) {
    } catch (IllegalAccessException x) {
    } catch (InvocationTargetException x) {
    }
  }