Mercurial > projects > dwt-addons
comparison dwtx/jface/text/AbstractLineTracker.d @ 159:7926b636c282
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 01:57:58 +0200 |
parents | f70d9508c95c |
children | 1a5b8f8129df |
comparison
equal
deleted
inserted
replaced
158:25f1f92fa3df | 159:7926b636c282 |
---|---|
157 import dwt.dwthelper.utils; | 157 import dwt.dwthelper.utils; |
158 | 158 |
159 import dwtx.dwtxhelper.Collection; | 159 import dwtx.dwtxhelper.Collection; |
160 | 160 |
161 | 161 |
162 /** | |
163 * Combines the information of the occurrence of a line delimiter. <code>delimiterIndex</code> | |
164 * is the index where a line delimiter starts, whereas <code>delimiterLength</code>, | |
165 * indicates the length of the delimiter. | |
166 */ | |
167 protected class DelimiterInfo { | |
168 public int delimiterIndex; | |
169 public int delimiterLength; | |
170 public String delimiter; | |
171 } | |
172 alias DelimiterInfo AbstractLineTracker_DelimiterInfo; | |
162 | 173 |
163 /** | 174 /** |
164 * Abstract implementation of <code>ILineTracker</code>. It lets the definition of line | 175 * Abstract implementation of <code>ILineTracker</code>. It lets the definition of line |
165 * delimiters to subclasses. Assuming that '\n' is the only line delimiter, this abstract | 176 * delimiters to subclasses. Assuming that '\n' is the only line delimiter, this abstract |
166 * implementation defines the following line scheme: | 177 * implementation defines the following line scheme: |
184 * @since 3.1 | 195 * @since 3.1 |
185 */ | 196 */ |
186 private static const bool DEBUG= false; | 197 private static const bool DEBUG= false; |
187 | 198 |
188 /** | 199 /** |
189 * Combines the information of the occurrence of a line delimiter. <code>delimiterIndex</code> | |
190 * is the index where a line delimiter starts, whereas <code>delimiterLength</code>, | |
191 * indicates the length of the delimiter. | |
192 */ | |
193 protected static class DelimiterInfo { | |
194 public int delimiterIndex; | |
195 public int delimiterLength; | |
196 public String delimiter; | |
197 } | |
198 | |
199 /** | |
200 * Representation of replace and set requests. | 200 * Representation of replace and set requests. |
201 * | 201 * |
202 * @since 3.1 | 202 * @since 3.1 |
203 */ | 203 */ |
204 protected static class Request { | 204 protected static class Request { |
238 /** | 238 /** |
239 * The implementation that this tracker delegates to. | 239 * The implementation that this tracker delegates to. |
240 * | 240 * |
241 * @since 3.2 | 241 * @since 3.2 |
242 */ | 242 */ |
243 private ILineTracker fDelegate= new class() ListLineTracker { | 243 private ILineTracker fDelegate; |
244 public String[] getLegalLineDelimiters() { | 244 private void fDelegate_init() { |
245 return this.outer.getLegalLineDelimiters(); | 245 fDelegate = new class() ListLineTracker { |
246 } | 246 public String[] getLegalLineDelimiters() { |
247 | 247 return this.outer.getLegalLineDelimiters(); |
248 protected DelimiterInfo nextDelimiterInfo(String text, int offset) { | 248 } |
249 return this.outer.nextDelimiterInfo(text, offset); | 249 |
250 } | 250 protected DelimiterInfo nextDelimiterInfo(String text, int offset) { |
251 }; | 251 return this.outer.nextDelimiterInfo(text, offset); |
252 } | |
253 }; | |
254 } | |
252 /** | 255 /** |
253 * Whether the delegate needs conversion when the line structure is modified. | 256 * Whether the delegate needs conversion when the line structure is modified. |
254 */ | 257 */ |
255 private bool fNeedsConversion= true; | 258 private bool fNeedsConversion= true; |
256 | 259 |
257 /** | 260 /** |
258 * Creates a new line tracker. | 261 * Creates a new line tracker. |
259 */ | 262 */ |
260 protected this() { | 263 protected this() { |
264 fDelegate_init(); | |
261 } | 265 } |
262 | 266 |
263 /* | 267 /* |
264 * @see dwtx.jface.text.ILineTracker#computeNumberOfLines(java.lang.String) | 268 * @see dwtx.jface.text.ILineTracker#computeNumberOfLines(java.lang.String) |
265 */ | 269 */ |