|Databing with viewer input [message #897320]
||Mon, 23 July 2012 11:13
|| Simon SSC
Registered: April 2012
I am binding an TableViewer to my model, which contains a List of Objects.
The List is converted, by a Converter in the UpdateStrategy to a List of TableRowItem Objects, so that my model can be shown in the viewer.
IObservableValue observableViewerValue = ViewerProperties.input() .observe(tableViewer);
IObservableValue observableModelValue = ...IObservableValue form model...
...creation of the targetToModel and modelToTarget UpdateStrategies...
this.dataBindingContext.bindValue(observableViewerValue ,observableModelValue, targetToModel, modelToTarget);
With that code the input of the TableViewer is correctly filled by the converted model.
My Question is how to update the TableViewers input, when the input is changed with the org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport.
In the ObservableValueEditingSupport itself you have to return an IObservableValue in the doCreateElementObservable method.
I added an IValueChangeListener to that IObservableValue and realized that the Values are updated in the TableRowItem, which I mentioned before.
But it seems that the input of the viewer is only affected internally inside the TableRowItem, so that the model(observableModelValue in the sample code), which is bound to the input of the TableViewer, is not updated.
How do I trigger an update to the model which is bound to the input of the TableViewer?
Object input = viewer.getInput();
... does not update the model, which is bound to the input of the viewer