Editable combo is not properly binding to model property

207 views Asked by At

I am using org.eclipse.swt.widgets.Combo which is not read only, meaning a user can insert any string or may select from the dropdown box. But when I bind it to my model class property I get Null Pointer Exception whenever I am entering any text which is not present in the combo.

databindingContext.bindValue(WidgetProperties.singleSelectionIndex().observe(ComboReporterId), 
        BeansObservables.observeValue(Model, TextReporter_M));

Please help on this issue.

1

There are 1 answers

0
greg-449 On

For a Combo where text can be entered you will need to observe the text:

IObservableValue targetOV = WidgetProperties.text().observe(combo);

You will have to bind this to a value that is a String (or use a Converter).