KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > source > IAnnotationAccessExtension


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.text.source;
12
13 import org.eclipse.swt.graphics.GC;
14 import org.eclipse.swt.graphics.Rectangle;
15 import org.eclipse.swt.widgets.Canvas;
16
17 /**
18  * Extension interface for {@link org.eclipse.jface.text.source.IAnnotationAccess}.<p>
19  * This interface replaces the methods of <code>IAnnotationAccess</code>.<p>
20  * This interface provides
21  * <ul>
22  * <li> a label for the annotation type of a given annotation</li>
23  * <li> the paint layer of a given annotation</li>
24  * <li> means to paint a given annotation</li>
25  * <li> information about the type hierarchy of the annotation type of a given annotation</li>
26  * <ul>.
27  *
28  * @see org.eclipse.jface.text.source.IAnnotationAccess
29  * @since 3.0
30  */

31 public interface IAnnotationAccessExtension {
32
33     /**
34      * The default annotation layer.
35      */

36     static final int DEFAULT_LAYER= IAnnotationPresentation.DEFAULT_LAYER;
37
38     /**
39      * Returns the label for the given annotation's type.
40      *
41      * @param annotation the annotation
42      * @return the label the given annotation's type or <code>null</code> if no such label exists
43      */

44     String JavaDoc getTypeLabel(Annotation annotation);
45
46     /**
47      * Returns the layer for given annotation. Annotations are considered
48      * being located at layers and are considered being painted starting with
49      * layer 0 upwards. Thus an annotation at layer 5 will be drawn on top of
50      * all co-located annotations at the layers 4 - 0.
51      *
52      * @param annotation the annotation
53      * @return the layer of the given annotation
54      */

55     int getLayer(Annotation annotation);
56
57     /**
58      * Draws a graphical representation of the given annotation within the given bounds.
59      * <p>
60      * <em>Note that this method is not used when drawing annotations on the editor's
61      * text widget. This is handled trough a {@link org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy}.</em>
62      * </p>
63      * @param annotation the given annotation
64      * @param gc the drawing GC
65      * @param canvas the canvas to draw on
66      * @param bounds the bounds inside the canvas to draw on
67      */

68     void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds);
69
70     /**
71      * Returns <code>true</code> if painting <code>annotation</code> will produce something
72      * meaningful, <code>false</code> if not. E.g. if no image is available.
73      * <p>
74      * <em>Note that this method is not used when drawing annotations on the editor's
75      * text widget. This is handled trough a {@link org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy}.</em>
76      * </p>
77      * @param annotation the annotation to check whether it can be painted
78      * @return <code>true</code> if painting <code>annotation</code> will succeed
79      */

80     boolean isPaintable(Annotation annotation);
81
82     /**
83      * Returns <code>true</code> if the given annotation is of the given type
84      * or <code>false</code> otherwise.
85      *
86      * @param annotationType the annotation type
87      * @param potentialSupertype the potential super annotation type
88      * @return <code>true</code> if annotation type is a sub-type of the potential annotation super type
89      */

90     boolean isSubtype(Object JavaDoc annotationType, Object JavaDoc potentialSupertype);
91
92     /**
93      * Returns the list of super types for the given annotation type. This does not include the type
94      * itself. The index in the array of super types indicates the length of the path in the hierarchy
95      * graph to the given annotation type.
96      *
97      * @param annotationType the annotation type to check
98      * @return the super types for the given annotation type
99      */

100     Object JavaDoc[] getSupertypes(Object JavaDoc annotationType);
101 }
102
Popular Tags