KickJava   Java API By Example, From Geeks To Geeks.

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


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
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.Control;
16
17 import org.eclipse.jface.text.ITextViewer;
18
19
20 /**
21  * This interface defines a visual component which may serve text viewers as an
22  * annotation presentation area. Implementers of this interface have to define
23  * the presentation modus. This can either depend on the connected viewer's view
24  * port or not. If the modus is view port dependent the ruler only shows those
25  * annotations that are attached to document regions that are visible in the
26  * view port. If independent, the presented annotations can also be attached to
27  * invisible document regions.
28  *
29  * This interfaces comprises three contracts:
30  * <ul>
31  * <li>The vertical ruler retrieves the annotations it presents from an
32  * annotation model.
33  * <li>The ruler is a visual component which must be integrated in a hierarchy
34  * of SWT controls.
35  * <li>The ruler provides interested clients with mapping and interaction
36  * information. This covers the mapping between coordinates of the ruler's
37  * control and line numbers based on the connected text viewer's document (see
38  * {@link org.eclipse.jface.text.source.IVerticalRulerInfo}).
39  * </ul>
40  * <p>
41  * In order to provide backward compatibility for clients of
42  * <code>IVerticalRuler</code>, extension interfaces are used as a means of
43  * evolution. The following extension interfaces exist:
44  * <ul>
45  * <li>{@link org.eclipse.jface.text.source.IVerticalRulerExtension} since
46  * version 2.0 introducing setters for font and mouse button activity location.</li>
47  * </ul></p>
48  * <p>
49  * Clients may implement this interface or use the default implementation
50  * provided by {@link org.eclipse.jface.text.source.CompositeRuler} and
51  * {@link org.eclipse.jface.text.source.VerticalRuler}.</p>
52  *
53  * @see org.eclipse.jface.text.source.IVerticalRulerExtension
54  * @see org.eclipse.jface.text.ITextViewer
55  */

56 public interface IVerticalRuler extends IVerticalRulerInfo {
57
58     /**
59      * Associates an annotation model with this ruler.
60      * A value <code>null</code> is acceptable and clears the ruler.
61      *
62      * @param model the new annotation model, may be <code>null</code>
63      */

64     void setModel(IAnnotationModel model);
65
66     /**
67      * Returns the current annotation model of this ruler or <code>null</code>
68      * if the ruler has no model.
69      *
70      * @return this ruler's annotation model or <code>null</code> if there is no model
71      */

72     IAnnotationModel getModel();
73
74     /**
75      * Forces the vertical ruler to synchronize itself with its
76      * annotation model and its viewer's view port.
77      */

78     void update();
79
80     /**
81      * Creates the ruler's SWT control.
82      *
83      * @param parent the parent control of the ruler's control
84      * @param textViewer the text viewer to which this ruler belongs
85      * @return the ruler's SWT control
86      */

87     Control createControl(Composite parent, ITextViewer textViewer);
88 }
89
Popular Tags