Mercurial > projects > dwt2
comparison org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/TextSegment.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 |
---|---|
10 * Port to the D programming language: | 10 * Port to the D programming language: |
11 * Frank Benoit <benoit@tionex.de> | 11 * Frank Benoit <benoit@tionex.de> |
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module org.eclipse.ui.internal.forms.widgets.TextSegment; | 13 module org.eclipse.ui.internal.forms.widgets.TextSegment; |
14 | 14 |
15 import java.lang.all; | |
16 | |
15 import org.eclipse.ui.internal.forms.widgets.ParagraphSegment; | 17 import org.eclipse.ui.internal.forms.widgets.ParagraphSegment; |
16 import org.eclipse.ui.internal.forms.widgets.Locator; | 18 import org.eclipse.ui.internal.forms.widgets.Locator; |
17 import org.eclipse.ui.internal.forms.widgets.SelectionData; | 19 import org.eclipse.ui.internal.forms.widgets.SelectionData; |
18 import org.eclipse.ui.internal.forms.widgets.FormTextModel; | 20 import org.eclipse.ui.internal.forms.widgets.FormTextModel; |
19 | 21 |
20 // import com.ibm.icu.text.BreakIterator; | 22 import java.util.ArrayList; |
23 import java.util.Hashtable; | |
24 import java.util.Vector; | |
25 import java.util.Set; | |
21 | 26 |
22 import org.eclipse.swt.SWT; | 27 import org.eclipse.swt.SWT; |
23 import org.eclipse.swt.graphics.Color; | 28 import org.eclipse.swt.graphics.Color; |
24 import org.eclipse.swt.graphics.Font; | 29 import org.eclipse.swt.graphics.Font; |
25 import org.eclipse.swt.graphics.FontMetrics; | 30 import org.eclipse.swt.graphics.FontMetrics; |
26 import org.eclipse.swt.graphics.GC; | 31 import org.eclipse.swt.graphics.GC; |
27 import org.eclipse.swt.graphics.Point; | 32 import org.eclipse.swt.graphics.Point; |
28 import org.eclipse.swt.graphics.Rectangle; | 33 import org.eclipse.swt.graphics.Rectangle; |
29 | 34 |
30 import java.lang.all; | 35 import com.ibm.icu.text.BreakIterator; |
31 import java.util.Vector; | |
32 import java.util.Hashtable; | |
33 import java.util.ArrayList; | |
34 import java.util.Set; | |
35 import java.mangoicu.UBreakIterator; | |
36 | 36 |
37 /** | 37 /** |
38 * @version 1.0 | 38 * @version 1.0 |
39 * @author | 39 * @author |
40 */ | 40 */ |
718 | 718 |
719 private void computeTextFragments(GC gc) { | 719 private void computeTextFragments(GC gc) { |
720 if (textFragments !is null) | 720 if (textFragments !is null) |
721 return; | 721 return; |
722 ArrayList list = new ArrayList(); | 722 ArrayList list = new ArrayList(); |
723 auto wb = UBreakIterator.openLineIterator( ULocale.Default, getText() ); | 723 BreakIterator wb = BreakIterator.getLineInstance(); |
724 scope(exit) wb.close(); | 724 wb.setText(getText()); |
725 int cursor = 0; | 725 int cursor = 0; |
726 for (int loc = wb.first(); loc !is UBreakIterator.Done; loc = wb.next()) { | 726 for (int loc = wb.first(); loc !is BreakIterator.DONE; loc = wb.next()) { |
727 if (loc is 0) | 727 if (loc is 0) |
728 continue; | 728 continue; |
729 String word = text.substring(cursor, loc); | 729 String word = text.substring(cursor, loc); |
730 Point extent = gc.textExtent(word); | 730 Point extent = gc.textExtent(word); |
731 list.add(new TextFragment(cast(short) loc, cast(short) extent.x)); | 731 list.add(new TextFragment(cast(short) loc, cast(short) extent.x)); |