--- /dev/null
+package eu.etaxonomy.taxeditor.prototype2.view.nameviewersupport;\r
+\r
+import org.eclipse.jface.text.source.Annotation;\r
+import org.eclipse.jface.text.source.IAnnotationAccess;\r
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;\r
+import org.eclipse.jface.text.source.ImageUtilities;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.graphics.GC;\r
+import org.eclipse.swt.graphics.Rectangle;\r
+import org.eclipse.swt.widgets.Canvas;\r
+\r
+public class AnnotationMarkerAccess implements IAnnotationAccess, IAnnotationAccessExtension {\r
+ public Object getType(Annotation annotation) {\r
+ return annotation.getType();\r
+ }\r
+\r
+ public boolean isMultiLine(Annotation annotation) {\r
+ return true;\r
+ }\r
+\r
+ public boolean isTemporary(Annotation annotation) {\r
+ return !annotation.isPersistent();\r
+ }\r
+\r
+ public String getTypeLabel(Annotation annotation) {\r
+ if (annotation instanceof ErrorAnnotation)\r
+ return "Errors";\r
+\r
+ return null;\r
+ }\r
+\r
+ public int getLayer(Annotation annotation) {\r
+ if (annotation instanceof ErrorAnnotation)\r
+ return ((ErrorAnnotation)annotation).getLayer();\r
+\r
+ return 0;\r
+ }\r
+\r
+ public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {\r
+ ImageUtilities.drawImage(((ErrorAnnotation)annotation).getImage(), \r
+ gc, canvas, bounds, SWT.CENTER, SWT.TOP);\r
+ }\r
+\r
+ public boolean isPaintable(Annotation annotation) {\r
+ if (annotation instanceof ErrorAnnotation)\r
+ return ((ErrorAnnotation)annotation).getImage() != null;\r
+\r
+ return false;\r
+ }\r
+\r
+ public boolean isSubtype(Object annotationType, Object potentialSupertype) {\r
+ if (annotationType.equals(potentialSupertype))\r
+ return true;\r
+\r
+ return false;\r
+\r
+ }\r
+\r
+ public Object[] getSupertypes(Object annotationType) {\r
+ return new Object[0];\r
+ }\r
+}\r