1 package org.simantics.scl.ui.editor;
3 import org.eclipse.jface.resource.ImageDescriptor;
4 import org.eclipse.jface.resource.ImageRegistry;
5 import org.eclipse.jface.text.source.Annotation;
6 import org.eclipse.jface.text.source.IAnnotationAccess;
7 import org.eclipse.jface.text.source.IAnnotationAccessExtension;
8 import org.eclipse.jface.text.source.ImageUtilities;
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.graphics.GC;
11 import org.eclipse.swt.graphics.Image;
12 import org.eclipse.swt.graphics.Rectangle;
13 import org.eclipse.swt.widgets.Canvas;
15 final class SCLAnnotationAccessNew implements IAnnotationAccess, IAnnotationAccessExtension {
17 ImageRegistry registry;
19 public SCLAnnotationAccessNew(ImageRegistry registry) {
20 this.registry = registry;
24 public Object getType(Annotation annotation) {
25 return annotation.getType();
29 public boolean isMultiLine(Annotation annotation) {
34 public boolean isTemporary(Annotation annotation) {
35 return !annotation.isPersistent();
39 public String getTypeLabel(Annotation annotation) {
40 return annotation.getType();
44 public int getLayer(Annotation annotation) {
49 public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
50 Image image = registry.get("error"); //$NON-NLS-1$
52 registry.put("error", ImageDescriptor.createFromFile(getClass(), "error_tsk.gif")); //$NON-NLS-1$ //$NON-NLS-2$
53 image = registry.get("error"); //$NON-NLS-1$
55 ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
59 public boolean isPaintable(Annotation annotation) {
64 public boolean isSubtype(Object annotationType, Object potentialSupertype) {
65 return annotationType.equals(potentialSupertype);
69 public Object[] getSupertypes(Object annotationType) {