Mercurial > projects > dwt-addons
comparison dwtx/jface/text/DefaultTextDoubleClickStrategy.d @ 170:284c2e810329
compile of JFace.Text is ok now
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 09 Sep 2008 18:46:06 +0200 |
parents | 1a5b8f8129df |
children |
comparison
equal
deleted
inserted
replaced
169:3b8f773f35e4 | 170:284c2e810329 |
---|---|
174 * @see java.text.UBreakIterator | 174 * @see java.text.UBreakIterator |
175 * @noextend This class is not intended to be subclassed by clients. | 175 * @noextend This class is not intended to be subclassed by clients. |
176 */ | 176 */ |
177 public class DefaultTextDoubleClickStrategy : ITextDoubleClickStrategy { | 177 public class DefaultTextDoubleClickStrategy : ITextDoubleClickStrategy { |
178 | 178 |
179 | 179 /++ |
180 /** | 180 /** |
181 * Implements a character iterator that works directly on | 181 * Implements a character iterator that works directly on |
182 * instances of <code>IDocument</code>. Used to collaborate with | 182 * instances of <code>IDocument</code>. Used to collaborate with |
183 * the break iterator. | 183 * the break iterator. |
184 * | 184 * |
306 i.fOffset= fOffset; | 306 i.fOffset= fOffset; |
307 i.fEndOffset= fEndOffset; | 307 i.fEndOffset= fEndOffset; |
308 return i; | 308 return i; |
309 } | 309 } |
310 } | 310 } |
311 | 311 ++/ |
312 | 312 |
313 /** | 313 /** |
314 * The document character iterator used by this strategy. | 314 * The document character iterator used by this strategy. |
315 * @since 2.0 | 315 * @since 2.0 |
316 */ | 316 */ |
317 private DocumentCharacterIterator fDocIter= new DocumentCharacterIterator(); | 317 // private DocumentCharacterIterator fDocIter= new DocumentCharacterIterator(); |
318 | 318 |
319 | 319 |
320 /** | 320 /** |
321 * Creates a new default text double click strategy. | 321 * Creates a new default text double click strategy. |
322 */ | 322 */ |
339 IDocument document= text.getDocument(); | 339 IDocument document= text.getDocument(); |
340 IRegion line= document.getLineInformationOfOffset(position); | 340 IRegion line= document.getLineInformationOfOffset(position); |
341 if (position is line.getOffset() + line.getLength()) | 341 if (position is line.getOffset() + line.getLength()) |
342 return; | 342 return; |
343 | 343 |
344 fDocIter.setDocument(document, line); | 344 //mangoicu |
345 | 345 // fDocIter.setDocument(document, line); |
346 UBreakIterator breakIter= UBreakIterator.openWordIterator( ULocale.Default, fDocIter ); | 346 String strLine = document.get( line.getOffset(), line.getLength() ); |
347 | 347 UBreakIterator breakIter= UBreakIterator.openWordIterator( ULocale.Default, strLine/+fDocIter+/ ); |
348 int start= breakIter.preceding(position); | 348 |
349 | |
350 //int start= breakIter.preceding(position); | |
351 int start= breakIter.previous(position); // mangoicu | |
349 if (start is UBreakIterator.DONE) | 352 if (start is UBreakIterator.DONE) |
350 start= line.getOffset(); | 353 start= line.getOffset(); |
351 | 354 |
352 int end= breakIter.following(position); | 355 int end= breakIter.following(position); |
353 if (end is UBreakIterator.DONE) | 356 if (end is UBreakIterator.DONE) |