KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > ITextViewerExtension5


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;
12
13 /**
14  * Extension interface for {@link org.eclipse.jface.text.ITextViewer}. Defines
15  * a conceptual replacement of the original visible region concept. This interface
16  * replaces {@link org.eclipse.jface.text.ITextViewerExtension3}.
17  * <p>
18  * Introduces the explicit concept of model and widget coordinates. For example,
19  * a selection returned by the text viewer's control is a widget selection. A
20  * widget selection always maps to a certain range of the viewer's document.
21  * This range is considered the model selection.
22  * <p>
23  * All model ranges that have a corresponding widget ranges are considered
24  * "exposed model ranges". The viewer can be requested to expose a given model
25  * range. Thus, a visible region is a particular degeneration of exposed model
26  * ranges.
27  * <p>
28  * This interface allows implementers to follow a sophisticated presentation
29  * model in which the visible presentation is a complex projection of the
30  * viewer's input document.
31  *
32  * @since 3.0
33  */

34 public interface ITextViewerExtension5 extends ITextViewerExtension3 {
35
36     /**
37      * Returns the minimal region of the viewer's input document that completely
38      * comprises everything that is visible in the viewer's widget or
39      * <code>null</code> if there is no such region.
40      *
41      * @return the minimal region of the viewer's document comprising the
42      * contents of the viewer's widget or <code>null</code>
43      */

44     IRegion getModelCoverage();
45
46     /**
47      * Returns the widget line that corresponds to the given line of the
48      * viewer's input document or <code>-1</code> if there is no such line.
49      *
50      * @param modelLine the line of the viewer's document
51      * @return the corresponding widget line or <code>-1</code>
52      */

53     int modelLine2WidgetLine(int modelLine);
54
55     /**
56      * Returns the widget offset that corresponds to the given offset in the
57      * viewer's input document or <code>-1</code> if there is no such offset
58      *
59      * @param modelOffset the offset in the viewer's document
60      * @return the corresponding widget offset or <code>-1</code>
61      */

62     int modelOffset2WidgetOffset(int modelOffset);
63
64     /**
65      * Returns the minimal region of the viewer's widget that completely
66      * comprises the given region of the viewer's input document or
67      * <code>null</code> if there is no such region.
68      *
69      * @param modelRange the region of the viewer's document
70      * @return the minimal region of the widget comprising
71      * <code>modelRange</code> or <code>null</code>
72      */

73     IRegion modelRange2WidgetRange(IRegion modelRange);
74
75     /**
76      * Returns the offset of the viewer's input document that corresponds to the
77      * given widget offset or <code>-1</code> if there is no such offset
78      *
79      * @param widgetOffset the widget offset
80      * @return the corresponding offset in the viewer's document or
81      * <code>-1</code>
82      */

83     int widgetOffset2ModelOffset(int widgetOffset);
84
85     /**
86      * Returns the minimal region of the viewer's input document that completely
87      * comprises the given widget region or <code>null</code> if there is no
88      * such region.
89      *
90      * @param widgetRange the widget region
91      * @return the minimal region of the viewer's document comprising
92      * <code>widgetlRange</code> or <code>null</code>
93      */

94     IRegion widgetRange2ModelRange(IRegion widgetRange);
95
96     /**
97      * Returns the line of the viewer's input document that corresponds to the
98      * given widget line or <code>-1</code> if there is no such line.
99      *
100      * @param widgetLine the widget line
101      * @return the corresponding line of the viewer's document or
102      * <code>-1</code>
103      */

104     int widgetLine2ModelLine(int widgetLine);
105
106     /**
107      * Returns the widget line of the given widget offset.
108      *
109      * @param widgetOffset the widget offset
110      * @return the widget line of the widget offset
111      */

112     int widgetLineOfWidgetOffset(int widgetOffset);
113
114
115     /**
116      * Returns the maximal subranges of the given model range thus that there is
117      * no offset inside a subrange for which there is no image offset.
118      *
119      * @param modelRange the model range
120      * @return the list of subranges
121      */

122     IRegion[] getCoveredModelRanges(IRegion modelRange);
123
124     /**
125      * Exposes the given model range. Returns whether this call caused a change
126      * of the set of exposed model ranges.
127      *
128      * @param modelRange the model range to be exposed
129      * @return <code>true</code> if the set of exposed model ranges changed,
130      * <code>false</code> otherwise
131      */

132     boolean exposeModelRange(IRegion modelRange);
133 }
134
Popular Tags