comparison org.eclipse.jface.text/src/org/eclipse/jface/text/ITextViewerExtension5.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module org.eclipse.jface.text.ITextViewerExtension5;
14
15 import org.eclipse.jface.text.IRegion; // packageimport
16 import org.eclipse.jface.text.ITextViewerExtension3; // packageimport
17
18 import java.lang.all;
19 import java.util.Set;
20
21 /**
22 * Extension interface for {@link org.eclipse.jface.text.ITextViewer}. Defines
23 * a conceptual replacement of the original visible region concept. This interface
24 * replaces {@link org.eclipse.jface.text.ITextViewerExtension3}.
25 * <p>
26 * Introduces the explicit concept of model and widget coordinates. For example,
27 * a selection returned by the text viewer's control is a widget selection. A
28 * widget selection always maps to a certain range of the viewer's document.
29 * This range is considered the model selection.
30 * <p>
31 * All model ranges that have a corresponding widget ranges are considered
32 * "exposed model ranges". The viewer can be requested to expose a given model
33 * range. Thus, a visible region is a particular degeneration of exposed model
34 * ranges.
35 * <p>
36 * This interface allows implementers to follow a sophisticated presentation
37 * model in which the visible presentation is a complex projection of the
38 * viewer's input document.
39 *
40 * @since 3.0
41 */
42 public interface ITextViewerExtension5 : ITextViewerExtension3 {
43
44 /**
45 * Returns the minimal region of the viewer's input document that completely
46 * comprises everything that is visible in the viewer's widget or
47 * <code>null</code> if there is no such region.
48 *
49 * @return the minimal region of the viewer's document comprising the
50 * contents of the viewer's widget or <code>null</code>
51 */
52 IRegion getModelCoverage();
53
54 /**
55 * Returns the widget line that corresponds to the given line of the
56 * viewer's input document or <code>-1</code> if there is no such line.
57 *
58 * @param modelLine the line of the viewer's document
59 * @return the corresponding widget line or <code>-1</code>
60 */
61 int modelLine2WidgetLine(int modelLine);
62
63 /**
64 * Returns the widget offset that corresponds to the given offset in the
65 * viewer's input document or <code>-1</code> if there is no such offset
66 *
67 * @param modelOffset the offset in the viewer's document
68 * @return the corresponding widget offset or <code>-1</code>
69 */
70 int modelOffset2WidgetOffset(int modelOffset);
71
72 /**
73 * Returns the minimal region of the viewer's widget that completely
74 * comprises the given region of the viewer's input document or
75 * <code>null</code> if there is no such region.
76 *
77 * @param modelRange the region of the viewer's document
78 * @return the minimal region of the widget comprising
79 * <code>modelRange</code> or <code>null</code>
80 */
81 IRegion modelRange2WidgetRange(IRegion modelRange);
82
83 /**
84 * Returns the offset of the viewer's input document that corresponds to the
85 * given widget offset or <code>-1</code> if there is no such offset
86 *
87 * @param widgetOffset the widget offset
88 * @return the corresponding offset in the viewer's document or
89 * <code>-1</code>
90 */
91 int widgetOffset2ModelOffset(int widgetOffset);
92
93 /**
94 * Returns the minimal region of the viewer's input document that completely
95 * comprises the given widget region or <code>null</code> if there is no
96 * such region.
97 *
98 * @param widgetRange the widget region
99 * @return the minimal region of the viewer's document comprising
100 * <code>widgetlRange</code> or <code>null</code>
101 */
102 IRegion widgetRange2ModelRange(IRegion widgetRange);
103
104 /**
105 * Returns the line of the viewer's input document that corresponds to the
106 * given widget line or <code>-1</code> if there is no such line.
107 *
108 * @param widgetLine the widget line
109 * @return the corresponding line of the viewer's document or
110 * <code>-1</code>
111 */
112 int widgetLine2ModelLine(int widgetLine);
113
114 /**
115 * Returns the widget line of the given widget offset.
116 *
117 * @param widgetOffset the widget offset
118 * @return the widget line of the widget offset
119 */
120 int widgetLineOfWidgetOffset(int widgetOffset);
121
122
123 /**
124 * Returns the maximal subranges of the given model range thus that there is
125 * no offset inside a subrange for which there is no image offset.
126 *
127 * @param modelRange the model range
128 * @return the list of subranges
129 */
130 IRegion[] getCoveredModelRanges(IRegion modelRange);
131
132 /**
133 * Exposes the given model range. Returns whether this call caused a change
134 * of the set of exposed model ranges.
135 *
136 * @param modelRange the model range to be exposed
137 * @return <code>true</code> if the set of exposed model ranges changed,
138 * <code>false</code> otherwise
139 */
140 bool exposeModelRange(IRegion modelRange);
141 }