Deepak Sharma
Deepak Sharma

Reputation: 99

Editable combo is not properly binding to model property

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.

Upvotes: 1

Views: 214

Answers (1)

greg-449
greg-449

Reputation: 111142

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).

Upvotes: 1

Related Questions