Mercurial > projects > dwt-addons
annotate dwtx/jface/text/ILineTracker.d @ 139:93a6ec48fd28
Regexp throws removal in interfaces
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:31:41 +0200 |
parents | c4fb132a086c |
children |
rev | line source |
---|---|
129 | 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 dwtx.jface.text.ILineTracker; | |
14 | |
131 | 15 import dwtx.jface.text.IDocumentPartitioningListener; // packageimport |
16 import dwtx.jface.text.DefaultTextHover; // packageimport | |
17 import dwtx.jface.text.AbstractInformationControl; // packageimport | |
18 import dwtx.jface.text.TextUtilities; // packageimport | |
19 import dwtx.jface.text.IInformationControlCreatorExtension; // packageimport | |
20 import dwtx.jface.text.AbstractInformationControlManager; // packageimport | |
21 import dwtx.jface.text.ITextViewerExtension2; // packageimport | |
22 import dwtx.jface.text.IDocumentPartitioner; // packageimport | |
23 import dwtx.jface.text.DefaultIndentLineAutoEditStrategy; // packageimport | |
24 import dwtx.jface.text.ITextSelection; // packageimport | |
25 import dwtx.jface.text.Document; // packageimport | |
26 import dwtx.jface.text.FindReplaceDocumentAdapterContentProposalProvider; // packageimport | |
27 import dwtx.jface.text.ITextListener; // packageimport | |
28 import dwtx.jface.text.BadPartitioningException; // packageimport | |
29 import dwtx.jface.text.ITextViewerExtension5; // packageimport | |
30 import dwtx.jface.text.IDocumentPartitionerExtension3; // packageimport | |
31 import dwtx.jface.text.IUndoManager; // packageimport | |
32 import dwtx.jface.text.ITextHoverExtension2; // packageimport | |
33 import dwtx.jface.text.IRepairableDocument; // packageimport | |
34 import dwtx.jface.text.IRewriteTarget; // packageimport | |
35 import dwtx.jface.text.DefaultPositionUpdater; // packageimport | |
36 import dwtx.jface.text.RewriteSessionEditProcessor; // packageimport | |
37 import dwtx.jface.text.TextViewerHoverManager; // packageimport | |
38 import dwtx.jface.text.DocumentRewriteSession; // packageimport | |
39 import dwtx.jface.text.TextViewer; // packageimport | |
40 import dwtx.jface.text.ITextViewerExtension8; // packageimport | |
41 import dwtx.jface.text.RegExMessages; // packageimport | |
42 import dwtx.jface.text.IDelayedInputChangeProvider; // packageimport | |
43 import dwtx.jface.text.ITextOperationTargetExtension; // packageimport | |
44 import dwtx.jface.text.IWidgetTokenOwner; // packageimport | |
45 import dwtx.jface.text.IViewportListener; // packageimport | |
46 import dwtx.jface.text.GapTextStore; // packageimport | |
47 import dwtx.jface.text.MarkSelection; // packageimport | |
48 import dwtx.jface.text.IDocumentPartitioningListenerExtension; // packageimport | |
49 import dwtx.jface.text.IDocumentAdapterExtension; // packageimport | |
50 import dwtx.jface.text.IInformationControlExtension; // packageimport | |
51 import dwtx.jface.text.IDocumentPartitioningListenerExtension2; // packageimport | |
52 import dwtx.jface.text.DefaultDocumentAdapter; // packageimport | |
53 import dwtx.jface.text.ITextViewerExtension3; // packageimport | |
54 import dwtx.jface.text.IInformationControlCreator; // packageimport | |
55 import dwtx.jface.text.TypedRegion; // packageimport | |
56 import dwtx.jface.text.ISynchronizable; // packageimport | |
57 import dwtx.jface.text.IMarkRegionTarget; // packageimport | |
58 import dwtx.jface.text.TextViewerUndoManager; // packageimport | |
59 import dwtx.jface.text.IRegion; // packageimport | |
60 import dwtx.jface.text.IInformationControlExtension2; // packageimport | |
61 import dwtx.jface.text.IDocumentExtension4; // packageimport | |
62 import dwtx.jface.text.IDocumentExtension2; // packageimport | |
63 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport | |
64 import dwtx.jface.text.Assert; // packageimport | |
65 import dwtx.jface.text.DefaultInformationControl; // packageimport | |
66 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport | |
67 import dwtx.jface.text.DocumentClone; // packageimport | |
68 import dwtx.jface.text.DefaultUndoManager; // packageimport | |
69 import dwtx.jface.text.IFindReplaceTarget; // packageimport | |
70 import dwtx.jface.text.IAutoEditStrategy; // packageimport | |
71 import dwtx.jface.text.ILineTrackerExtension; // packageimport | |
72 import dwtx.jface.text.IUndoManagerExtension; // packageimport | |
73 import dwtx.jface.text.TextSelection; // packageimport | |
74 import dwtx.jface.text.DefaultAutoIndentStrategy; // packageimport | |
75 import dwtx.jface.text.IAutoIndentStrategy; // packageimport | |
76 import dwtx.jface.text.IPainter; // packageimport | |
77 import dwtx.jface.text.IInformationControl; // packageimport | |
78 import dwtx.jface.text.IInformationControlExtension3; // packageimport | |
79 import dwtx.jface.text.ITextViewerExtension6; // packageimport | |
80 import dwtx.jface.text.IInformationControlExtension4; // packageimport | |
81 import dwtx.jface.text.DefaultLineTracker; // packageimport | |
82 import dwtx.jface.text.IDocumentInformationMappingExtension; // packageimport | |
83 import dwtx.jface.text.IRepairableDocumentExtension; // packageimport | |
84 import dwtx.jface.text.ITextHover; // packageimport | |
85 import dwtx.jface.text.FindReplaceDocumentAdapter; // packageimport | |
86 import dwtx.jface.text.Line; // packageimport | |
87 import dwtx.jface.text.ITextViewerExtension; // packageimport | |
88 import dwtx.jface.text.IDocumentAdapter; // packageimport | |
89 import dwtx.jface.text.TextEvent; // packageimport | |
90 import dwtx.jface.text.BadLocationException; // packageimport | |
91 import dwtx.jface.text.AbstractDocument; // packageimport | |
92 import dwtx.jface.text.AbstractLineTracker; // packageimport | |
93 import dwtx.jface.text.TreeLineTracker; // packageimport | |
94 import dwtx.jface.text.ITextPresentationListener; // packageimport | |
95 import dwtx.jface.text.Region; // packageimport | |
96 import dwtx.jface.text.ITextViewer; // packageimport | |
97 import dwtx.jface.text.IDocumentInformationMapping; // packageimport | |
98 import dwtx.jface.text.MarginPainter; // packageimport | |
99 import dwtx.jface.text.IPaintPositionManager; // packageimport | |
100 import dwtx.jface.text.TextPresentation; // packageimport | |
101 import dwtx.jface.text.IFindReplaceTargetExtension; // packageimport | |
102 import dwtx.jface.text.ISlaveDocumentManagerExtension; // packageimport | |
103 import dwtx.jface.text.ISelectionValidator; // packageimport | |
104 import dwtx.jface.text.IDocumentExtension; // packageimport | |
105 import dwtx.jface.text.PropagatingFontFieldEditor; // packageimport | |
106 import dwtx.jface.text.ConfigurableLineTracker; // packageimport | |
107 import dwtx.jface.text.SlaveDocumentEvent; // packageimport | |
108 import dwtx.jface.text.IDocumentListener; // packageimport | |
109 import dwtx.jface.text.PaintManager; // packageimport | |
110 import dwtx.jface.text.IFindReplaceTargetExtension3; // packageimport | |
111 import dwtx.jface.text.ITextDoubleClickStrategy; // packageimport | |
112 import dwtx.jface.text.IDocumentExtension3; // packageimport | |
113 import dwtx.jface.text.Position; // packageimport | |
114 import dwtx.jface.text.TextMessages; // packageimport | |
115 import dwtx.jface.text.CopyOnWriteTextStore; // packageimport | |
116 import dwtx.jface.text.WhitespaceCharacterPainter; // packageimport | |
117 import dwtx.jface.text.IPositionUpdater; // packageimport | |
118 import dwtx.jface.text.DefaultTextDoubleClickStrategy; // packageimport | |
119 import dwtx.jface.text.ListLineTracker; // packageimport | |
120 import dwtx.jface.text.ITextInputListener; // packageimport | |
121 import dwtx.jface.text.BadPositionCategoryException; // packageimport | |
122 import dwtx.jface.text.IWidgetTokenKeeperExtension; // packageimport | |
123 import dwtx.jface.text.IInputChangedListener; // packageimport | |
124 import dwtx.jface.text.ITextOperationTarget; // packageimport | |
125 import dwtx.jface.text.IDocumentInformationMappingExtension2; // packageimport | |
126 import dwtx.jface.text.ITextViewerExtension7; // packageimport | |
127 import dwtx.jface.text.IInformationControlExtension5; // packageimport | |
128 import dwtx.jface.text.IDocumentRewriteSessionListener; // packageimport | |
129 import dwtx.jface.text.JFaceTextUtil; // packageimport | |
130 import dwtx.jface.text.AbstractReusableInformationControlCreator; // packageimport | |
131 import dwtx.jface.text.TabsToSpacesConverter; // packageimport | |
132 import dwtx.jface.text.CursorLinePainter; // packageimport | |
133 import dwtx.jface.text.ITextHoverExtension; // packageimport | |
134 import dwtx.jface.text.IEventConsumer; // packageimport | |
135 import dwtx.jface.text.IDocument; // packageimport | |
136 import dwtx.jface.text.IWidgetTokenKeeper; // packageimport | |
137 import dwtx.jface.text.DocumentCommand; // packageimport | |
138 import dwtx.jface.text.TypedPosition; // packageimport | |
139 import dwtx.jface.text.IEditingSupportRegistry; // packageimport | |
140 import dwtx.jface.text.IDocumentPartitionerExtension; // packageimport | |
141 import dwtx.jface.text.AbstractHoverInformationControlManager; // packageimport | |
142 import dwtx.jface.text.IEditingSupport; // packageimport | |
143 import dwtx.jface.text.IMarkSelection; // packageimport | |
144 import dwtx.jface.text.ISlaveDocumentManager; // packageimport | |
145 import dwtx.jface.text.DocumentEvent; // packageimport | |
146 import dwtx.jface.text.DocumentPartitioningChangedEvent; // packageimport | |
147 import dwtx.jface.text.ITextStore; // packageimport | |
148 import dwtx.jface.text.JFaceTextMessages; // packageimport | |
149 import dwtx.jface.text.DocumentRewriteSessionEvent; // packageimport | |
150 import dwtx.jface.text.SequentialRewriteTextStore; // packageimport | |
151 import dwtx.jface.text.DocumentRewriteSessionType; // packageimport | |
152 import dwtx.jface.text.TextAttribute; // packageimport | |
153 import dwtx.jface.text.ITextViewerExtension4; // packageimport | |
154 import dwtx.jface.text.ITypedRegion; // packageimport | |
155 | |
156 | |
129 | 157 import dwt.dwthelper.utils; |
158 | |
159 | |
160 /** | |
161 * A line tracker maps character positions to line numbers and vice versa. | |
162 * Initially the line tracker is informed about its underlying text in order to | |
163 * initialize the mapping information. After that, the line tracker is informed | |
164 * about all changes of the underlying text allowing for incremental updates of | |
165 * the mapping information. It is the client's responsibility to actively inform | |
166 * the line tacker about text changes. For example, when using a line tracker in | |
167 * combination with a document the document controls the line tracker. | |
168 * <p> | |
169 * In order to provide backward compatibility for clients of <code>ILineTracker</code>, extension | |
170 * interfaces are used to provide a means of evolution. The following extension interfaces | |
171 * exist: | |
172 * <ul> | |
173 * <li> {@link dwtx.jface.text.ILineTrackerExtension} since version 3.1 introducing the concept | |
174 * of rewrite sessions.</li> | |
175 * </ul> | |
176 * <p> | |
177 * Clients may implement this interface or use the standard implementation | |
178 * </p> | |
179 * {@link dwtx.jface.text.DefaultLineTracker}or | |
180 * {@link dwtx.jface.text.ConfigurableLineTracker}. | |
181 */ | |
182 public interface ILineTracker { | |
183 | |
184 /** | |
185 * Returns the strings this tracker considers as legal line delimiters. | |
186 * | |
187 * @return the legal line delimiters | |
188 */ | |
189 String[] getLegalLineDelimiters(); | |
190 | |
191 /** | |
192 * Returns the line delimiter of the specified line. Returns <code>null</code> if the | |
193 * line is not closed with a line delimiter. | |
194 * | |
195 * @param line the line whose line delimiter is queried | |
196 * @return the line's delimiter or <code>null</code> if line does not have a delimiter | |
197 * @exception BadLocationException if the line number is invalid in this tracker's line structure | |
198 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
199 String getLineDelimiter(int line) ; |
129 | 200 |
201 /** | |
202 * Computes the number of lines in the given text. | |
203 * | |
204 * @param text the text whose number of lines should be computed | |
205 * @return the number of lines in the given text | |
206 */ | |
207 int computeNumberOfLines(String text); | |
208 | |
209 /** | |
210 * Returns the number of lines. | |
211 * | |
212 * @return the number of lines in this tracker's line structure | |
213 */ | |
214 int getNumberOfLines(); | |
215 | |
216 /** | |
217 * Returns the number of lines which are occupied by a given text range. | |
218 * | |
219 * @param offset the offset of the specified text range | |
220 * @param length the length of the specified text range | |
221 * @return the number of lines occupied by the specified range | |
222 * @exception BadLocationException if specified range is unknown to this tracker | |
223 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
224 int getNumberOfLines(int offset, int length) ; |
129 | 225 |
226 /** | |
227 * Returns the position of the first character of the specified line. | |
228 * | |
229 * @param line the line of interest | |
230 * @return offset of the first character of the line | |
231 * @exception BadLocationException if the line is unknown to this tracker | |
232 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
233 int getLineOffset(int line) ; |
129 | 234 |
235 /** | |
236 * Returns length of the specified line including the line's delimiter. | |
237 * | |
238 * @param line the line of interest | |
239 * @return the length of the line | |
240 * @exception BadLocationException if line is unknown to this tracker | |
241 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
242 int getLineLength(int line) ; |
129 | 243 |
244 /** | |
245 * Returns the line number the character at the given offset belongs to. | |
246 * | |
247 * @param offset the offset whose line number to be determined | |
248 * @return the number of the line the offset is on | |
249 * @exception BadLocationException if the offset is invalid in this tracker | |
250 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
251 int getLineNumberOfOffset(int offset) ; |
129 | 252 |
253 /** | |
254 * Returns a line description of the line at the given offset. | |
255 * The description contains the start offset and the length of the line | |
256 * excluding the line's delimiter. | |
257 * | |
258 * @param offset the offset whose line should be described | |
259 * @return a region describing the line | |
260 * @exception BadLocationException if offset is invalid in this tracker | |
261 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
262 IRegion getLineInformationOfOffset(int offset) ; |
129 | 263 |
264 /** | |
265 * Returns a line description of the given line. The description | |
266 * contains the start offset and the length of the line excluding the line's | |
267 * delimiter. | |
268 * | |
269 * @param line the line that should be described | |
270 * @return a region describing the line | |
271 * @exception BadLocationException if line is unknown to this tracker | |
272 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
273 IRegion getLineInformation(int line) ; |
129 | 274 |
275 /** | |
276 * Informs the line tracker about the specified change in the tracked text. | |
277 * | |
278 * @param offset the offset of the replaced text | |
279 * @param length the length of the replaced text | |
280 * @param text the substitution text | |
281 * @exception BadLocationException if specified range is unknown to this tracker | |
282 */ | |
139
93a6ec48fd28
Regexp throws removal in interfaces
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
283 void replace(int offset, int length, String text) ; |
129 | 284 |
285 /** | |
286 * Sets the tracked text to the specified text. | |
287 * | |
288 * @param text the new tracked text | |
289 */ | |
290 void set(String text); | |
291 } |