KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.Color;
14 import org.eclipse.swt.widgets.Control;
15
16 /**
17  * This interface defines a visual component which may serve
18  * text viewers as an overview annotation presentation area. This means,
19  * presentation of annotations is independent from the actual view port of
20  * the text viewer. The annotations of the viewer's whole document are
21  * visible in the overview ruler.
22  * <p>
23  * This interfaces embodies three contracts:
24  * <ul>
25  * <li> The overview ruler retrieves the annotations it presents from an annotation model.
26  * <li> The ruler is a visual component which must be integrated in a hierarchy of SWT controls.
27  * <li> The ruler provides interested clients with mapping and
28  * interaction information. This covers the mapping between
29  * coordinates of the ruler's control and line numbers based
30  * on the connected text viewer's document (<code>IVerticalRulerInfo</code>).
31  * </ul></p>
32  * <p>
33  * Clients may implement this interface or use the default implementation provided
34  * by <code>OverviewlRuler</code>.</p>
35  *
36  * @see org.eclipse.jface.text.ITextViewer
37  * @since 2.1
38  */

39 public interface IOverviewRuler extends IVerticalRuler {
40
41     /**
42      * Returns whether there is an annotation an the given vertical coordinate. This
43      * method takes the compression factor of the overview ruler into account.
44      *
45      * @param y the y-coordinate
46      * @return <code>true</code> if there is an annotation, <code>false</code> otherwise
47      */

48     boolean hasAnnotation(int y);
49
50     /**
51      * Returns the height of the visual presentation of an annotation in this
52      * overview ruler. Assumes that all annotations are represented using the
53      * same height.
54      *
55      * @return int the visual height of an annotation
56      */

57     int getAnnotationHeight();
58
59     /**
60      * Sets the color for the given annotation type in this overview ruler.
61      *
62      * @param annotationType the annotation type
63      * @param color the color
64      */

65     void setAnnotationTypeColor(Object JavaDoc annotationType, Color color);
66
67     /**
68      * Sets the drawing layer for the given annotation type in this overview ruler.
69      *
70      * @param annotationType the annotation type
71      * @param layer the drawing layer
72      */

73     void setAnnotationTypeLayer(Object JavaDoc annotationType, int layer);
74
75     /**
76      * Adds the given annotation type to this overview ruler. Starting with this
77      * call, annotations of the given type are shown in the overview ruler.
78      *
79      * @param annotationType the annotation type
80      */

81     void addAnnotationType(Object JavaDoc annotationType);
82
83     /**
84      * Removes the given annotation type from this overview ruler. Annotations
85      * of the given type are no longer shown in the overview ruler.
86      *
87      * @param annotationType the annotation type
88      */

89     void removeAnnotationType(Object JavaDoc annotationType);
90
91     /**
92      * Adds the given annotation type to the header of this ruler. Starting with
93      * this call, the presence of annotations is tracked and the header is drawn
94      * in the configured color.
95      *
96      * @param annotationType the annotation type to be tracked
97      */

98     void addHeaderAnnotationType(Object JavaDoc annotationType);
99
100     /**
101      * Removes the given annotation type from the header of this ruler. The
102      * presence of annotations of the given type is no longer tracked and the
103      * header is drawn in the default color, depending on the other configured
104      * configured annotation types.
105      *
106      * @param annotationType the annotation type to be removed
107      */

108     void removeHeaderAnnotationType(Object JavaDoc annotationType);
109
110     /**
111      * Returns this rulers header control. This is the little area between the
112      * top of the text widget and the top of this overview ruler.
113      *
114      * @return the header control of this overview ruler.
115      */

116     Control getHeaderControl();
117 }
118
Popular Tags