Mercurial > projects > dwt-addons
comparison dwtx/jface/viewers/ComboBoxViewerCellEditor.d @ 72:5df4896124c7
JFace and its examples do compile
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 22 May 2008 17:56:17 +0200 |
parents | 4878bef4a38e |
children | 7ffeace6c47f |
comparison
equal
deleted
inserted
replaced
71:4878bef4a38e | 72:5df4896124c7 |
---|---|
13 * Frank Benoit <benoit@tionex.de> | 13 * Frank Benoit <benoit@tionex.de> |
14 *******************************************************************************/ | 14 *******************************************************************************/ |
15 | 15 |
16 module dwtx.jface.viewers.ComboBoxViewerCellEditor; | 16 module dwtx.jface.viewers.ComboBoxViewerCellEditor; |
17 | 17 |
18 import java.text.MessageFormat; | 18 import dwtx.jface.viewers.AbstractComboBoxCellEditor; |
19 import dwtx.jface.viewers.ComboViewer; | |
20 import dwtx.jface.viewers.IStructuredContentProvider; | |
21 import dwtx.jface.viewers.CellEditor; | |
22 import dwtx.jface.viewers.IBaseLabelProvider; | |
23 import dwtx.jface.viewers.ISelection; | |
24 import dwtx.jface.viewers.IStructuredSelection; | |
25 import dwtx.jface.viewers.StructuredSelection; | |
19 | 26 |
20 import dwt.DWT; | 27 import dwt.DWT; |
21 import dwt.custom.CCombo; | 28 import dwt.custom.CCombo; |
22 import dwt.events.FocusAdapter; | 29 import dwt.events.FocusAdapter; |
23 import dwt.events.FocusEvent; | 30 import dwt.events.FocusEvent; |
100 public void widgetSelected(SelectionEvent event) { | 107 public void widgetSelected(SelectionEvent event) { |
101 ISelection selection = viewer.getSelection(); | 108 ISelection selection = viewer.getSelection(); |
102 if (selection.isEmpty()) { | 109 if (selection.isEmpty()) { |
103 selectedValue = null; | 110 selectedValue = null; |
104 } else { | 111 } else { |
105 selectedValue = ((IStructuredSelection) selection) | 112 selectedValue = (cast(IStructuredSelection) selection) |
106 .getFirstElement(); | 113 .getFirstElement(); |
107 } | 114 } |
108 } | 115 } |
109 }); | 116 }); |
110 | 117 |
223 // must set the selection before getting value | 230 // must set the selection before getting value |
224 ISelection selection = viewer.getSelection(); | 231 ISelection selection = viewer.getSelection(); |
225 if (selection.isEmpty()) { | 232 if (selection.isEmpty()) { |
226 selectedValue = null; | 233 selectedValue = null; |
227 } else { | 234 } else { |
228 selectedValue = ((IStructuredSelection) selection) | 235 selectedValue = (cast(IStructuredSelection) selection) |
229 .getFirstElement(); | 236 .getFirstElement(); |
230 } | 237 } |
231 | 238 |
232 Object newValue = doGetValue(); | 239 Object newValue = doGetValue(); |
233 markDirty(); | 240 markDirty(); |
234 bool isValid = isCorrect(newValue); | 241 bool isValid = isCorrect(newValue); |
235 setValueValid(isValid); | 242 setValueValid(isValid); |
236 | 243 |
237 if (!isValid) { | 244 if (!isValid) { |
238 MessageFormat.format(getErrorMessage(), | 245 //DWT: the result is not used? |
239 [ selectedValue ]); | 246 // MessageFormat.format(getErrorMessage(), |
247 // [ selectedValue ]); | |
240 } | 248 } |
241 | 249 |
242 fireApplyEditorValue(); | 250 fireApplyEditorValue(); |
243 deactivate(); | 251 deactivate(); |
244 } | 252 } |