Mercurial > projects > dwt-addons
comparison dwtx/jface/fieldassist/ContentProposalAdapter.d @ 104:04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 15:01:33 +0200 |
parents | 5df4896124c7 |
children | 862b05e0334a |
comparison
equal
deleted
inserted
replaced
103:2d6540440fe6 | 104:04b47443bb01 |
---|---|
17 import dwtx.jface.fieldassist.IControlContentAdapter; | 17 import dwtx.jface.fieldassist.IControlContentAdapter; |
18 import dwtx.jface.fieldassist.IControlContentAdapter2; | 18 import dwtx.jface.fieldassist.IControlContentAdapter2; |
19 import dwtx.jface.fieldassist.IContentProposalListener; | 19 import dwtx.jface.fieldassist.IContentProposalListener; |
20 import dwtx.jface.fieldassist.IContentProposalListener2; | 20 import dwtx.jface.fieldassist.IContentProposalListener2; |
21 | 21 |
22 import tango.util.collection.ArraySeq; | |
23 | 22 |
24 import dwt.DWT; | 23 import dwt.DWT; |
25 import dwt.events.DisposeEvent; | 24 import dwt.events.DisposeEvent; |
26 import dwt.events.DisposeListener; | 25 import dwt.events.DisposeListener; |
27 import dwt.events.FocusAdapter; | 26 import dwt.events.FocusAdapter; |
1046 return proposals; | 1045 return proposals; |
1047 } | 1046 } |
1048 | 1047 |
1049 // Check each string for a match. Use the string displayed to the | 1048 // Check each string for a match. Use the string displayed to the |
1050 // user, not the proposal content. | 1049 // user, not the proposal content. |
1051 auto list = new ArraySeq!(IContentProposal); | 1050 scope IContentProposal[] list = new IContentProposal[proposals.length]; |
1051 int idx = 0; | |
1052 for (int i = 0; i < proposals.length; i++) { | 1052 for (int i = 0; i < proposals.length; i++) { |
1053 String string = getString(proposals[i]); | 1053 String string = getString(proposals[i]); |
1054 if (string.length >= filterString.length | 1054 if (string.length >= filterString.length |
1055 && string.substring(0, filterString.length) | 1055 && string.substring(0, filterString.length) |
1056 .equalsIgnoreCase(filterString)) { | 1056 .equalsIgnoreCase(filterString)) { |
1057 list.append(proposals[i]); | 1057 list[idx++] = proposals[i]; |
1058 } | 1058 } |
1059 | 1059 |
1060 } | 1060 } |
1061 return list.toArray(); | 1061 return list[ 0 .. idx ].dup; |
1062 } | 1062 } |
1063 | 1063 |
1064 Listener getTargetControlListener() { | 1064 Listener getTargetControlListener() { |
1065 if (targetControlListener is null) { | 1065 if (targetControlListener is null) { |
1066 targetControlListener = new TargetControlListener(); | 1066 targetControlListener = new TargetControlListener(); |