Mercurial > projects > dwt2
comparison org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.d @ 92:ebefa5c2eab4
moving ICU bindings to com.ibm.icu
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 19 Apr 2009 13:49:38 +0200 |
parents | dbfb303e8fb0 |
children |
comparison
equal
deleted
inserted
replaced
91:2755ef2c8ef8 | 92:ebefa5c2eab4 |
---|---|
158 import java.lang.all; | 158 import java.lang.all; |
159 import java.util.Set; | 159 import java.util.Set; |
160 | 160 |
161 import java.text.CharacterIterator; | 161 import java.text.CharacterIterator; |
162 | 162 |
163 import java.mangoicu.UBreakIterator; | 163 import com.ibm.icu.text.BreakIterator; |
164 | 164 |
165 /** | 165 /** |
166 * Standard implementation of | 166 * Standard implementation of |
167 * {@link org.eclipse.jface.text.ITextDoubleClickStrategy}. | 167 * {@link org.eclipse.jface.text.ITextDoubleClickStrategy}. |
168 * <p> | 168 * <p> |
169 * Selects words using <code>java.text.UBreakIterator</code> for the default | 169 * Selects words using <code>java.text.BreakIterator</code> for the default |
170 * locale.</p> | 170 * locale.</p> |
171 * <p> | 171 * <p> |
172 * This class is not intended to be subclassed. | 172 * This class is not intended to be subclassed. |
173 * </p> | 173 * </p> |
174 * | 174 * |
175 * @see java.text.UBreakIterator | 175 * @see java.text.BreakIterator |
176 * @noextend This class is not intended to be subclassed by clients. | 176 * @noextend This class is not intended to be subclassed by clients. |
177 */ | 177 */ |
178 public class DefaultTextDoubleClickStrategy : ITextDoubleClickStrategy { | 178 public class DefaultTextDoubleClickStrategy : ITextDoubleClickStrategy { |
179 | 179 |
180 /++ | 180 /++ |
340 IDocument document= text.getDocument(); | 340 IDocument document= text.getDocument(); |
341 IRegion line= document.getLineInformationOfOffset(position); | 341 IRegion line= document.getLineInformationOfOffset(position); |
342 if (position is line.getOffset() + line.getLength()) | 342 if (position is line.getOffset() + line.getLength()) |
343 return; | 343 return; |
344 | 344 |
345 //mangoicu | 345 fDocIter.setDocument(document, line); |
346 // fDocIter.setDocument(document, line); | 346 |
347 String strLine = document.get( line.getOffset(), line.getLength() ); | 347 BreakIterator breakIter= BreakIterator.getWordInstance(); |
348 UBreakIterator breakIter= UBreakIterator.openWordIterator( ULocale.Default, strLine/+fDocIter+/ ); | 348 breakIter.setText(fDocIter); |
349 | 349 |
350 | 350 int start= breakIter.preceding(position); |
351 //int start= breakIter.preceding(position); | 351 if (start is BreakIterator.DONE) |
352 int start= breakIter.previous(position); // mangoicu | |
353 if (start is UBreakIterator.DONE) | |
354 start= line.getOffset(); | 352 start= line.getOffset(); |
355 | 353 |
356 int end= breakIter.following(position); | 354 int end= breakIter.following(position); |
357 if (end is UBreakIterator.DONE) | 355 if (end is BreakIterator.DONE) |
358 end= line.getOffset() + line.getLength(); | 356 end= line.getOffset() + line.getLength(); |
359 | 357 |
360 if (breakIter.isBoundary(position)) { | 358 if (breakIter.isBoundary(position)) { |
361 if (end - position > position- start) | 359 if (end - position > position- start) |
362 start= position; | 360 start= position; |