(no commit message)
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / prototype2 / view / nameviewersupport / AnnotationMarkerAccess.java
1 package eu.etaxonomy.taxeditor.prototype2.view.nameviewersupport;
2
3 import org.eclipse.jface.text.source.Annotation;
4 import org.eclipse.jface.text.source.IAnnotationAccess;
5 import org.eclipse.jface.text.source.IAnnotationAccessExtension;
6 import org.eclipse.jface.text.source.ImageUtilities;
7 import org.eclipse.swt.SWT;
8 import org.eclipse.swt.graphics.GC;
9 import org.eclipse.swt.graphics.Rectangle;
10 import org.eclipse.swt.widgets.Canvas;
11
12 public class AnnotationMarkerAccess implements IAnnotationAccess, IAnnotationAccessExtension {
13 public Object getType(Annotation annotation) {
14 return annotation.getType();
15 }
16
17 public boolean isMultiLine(Annotation annotation) {
18 return true;
19 }
20
21 public boolean isTemporary(Annotation annotation) {
22 return !annotation.isPersistent();
23 }
24
25 public String getTypeLabel(Annotation annotation) {
26 if (annotation instanceof ErrorAnnotation)
27 return "Errors";
28
29 return null;
30 }
31
32 public int getLayer(Annotation annotation) {
33 if (annotation instanceof ErrorAnnotation)
34 return ((ErrorAnnotation)annotation).getLayer();
35
36 return 0;
37 }
38
39 public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
40 ImageUtilities.drawImage(((ErrorAnnotation)annotation).getImage(),
41 gc, canvas, bounds, SWT.CENTER, SWT.TOP);
42 }
43
44 public boolean isPaintable(Annotation annotation) {
45 if (annotation instanceof ErrorAnnotation)
46 return ((ErrorAnnotation)annotation).getImage() != null;
47
48 return false;
49 }
50
51 public boolean isSubtype(Object annotationType, Object potentialSupertype) {
52 if (annotationType.equals(potentialSupertype))
53 return true;
54
55 return false;
56
57 }
58
59 public Object[] getSupertypes(Object annotationType) {
60 return new Object[0];
61 }
62 }