--- /dev/null
+package org.simantics.scl.ui.editor;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.jface.resource.ImageRegistry;\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.Image;\r
+import org.eclipse.swt.graphics.Rectangle;\r
+import org.eclipse.swt.widgets.Canvas;\r
+\r
+final class SCLAnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension {\r
+\r
+ ImageRegistry registry;\r
+ \r
+ public SCLAnnotationAccess(ImageRegistry registry) {\r
+ this.registry = registry;\r
+ }\r
+\r
+ @Override\r
+ public Object getType(Annotation annotation) {\r
+ return annotation.getType();\r
+ }\r
+\r
+ @Override\r
+ public boolean isMultiLine(Annotation annotation) {\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public boolean isTemporary(Annotation annotation) {\r
+ return !annotation.isPersistent();\r
+ }\r
+\r
+ @Override\r
+ public String getTypeLabel(Annotation annotation) {\r
+ return annotation.getType();\r
+ }\r
+\r
+ @Override\r
+ public int getLayer(Annotation annotation) {\r
+ return 0;\r
+ }\r
+\r
+ @Override\r
+ public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {\r
+ Image image = registry.get("error");\r
+ if(image == null) {\r
+ registry.put("error", ImageDescriptor.createFromFile(getClass(), "error_tsk.gif"));\r
+ image = registry.get("error");\r
+ }\r
+ ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);\r
+ }\r
+\r
+ @Override\r
+ public boolean isPaintable(Annotation annotation) {\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public boolean isSubtype(Object annotationType, Object potentialSupertype) {\r
+ return annotationType.equals(potentialSupertype);\r
+ }\r
+\r
+ @Override\r
+ public Object[] getSupertypes(Object annotationType) {\r
+ return new Object[0];\r
+ }\r
+}
\ No newline at end of file