Hi,
I'm having some problems with a master/detail binding.
I have Table with Entries of LAN interfaces (part of a EMF model). When selecting one, the user shall be able to edit it's settings through some Widgets below the table.
The table itself is a detail object too, master is a device (EMF model).
IObservableValue selection = ViewerProperties.singleSelection().observe(availableDevicesList);
availableDevicesList ist a TreeViewer with all devices which should managed.
TableViewer tableViewer = new TableViewer(this, SWT.SINGLE | SWT.BORDER
| SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tableViewer.setContentProvider(new ObservableListContentProvider());
tableViewer.setLabelProvider(new MyInterfaceTableLabelProvider());
Table table = tableViewer.getTable();
table.setLayoutData(formdata);
table.setLinesVisible(true);
//sets the columns and headers etc.
createTable(table);
// get the data observable
IObservableList list = EMFProperties.list( RadioPackage.Literals.RADIO__LAN_INTERFACES).observeDetail(selection);
tableViewer.setInput(list);
One widget for example:
Spinner mask = new Spinner(editGroup, SWT.BORDER);
mask.setMaximum(32);
mask.setMinimum(0);
//TODO change to properties, too
dbc.bindValue(SWTObservables.observeDelayedValue(400,
SWTObservables.observeSelection(mask)),
EMFObservables.observeDetailValue(Realm.getDefault(),
tableSelection, RadioPackage.Literals.LAN_INTERFACE__MASK));
A button to save the settings is enabled/disabled by the AggregateValidationStatus.
The problem is now: When I deselect all table entries (ctrl+space) the AggregateValidationStatus returns some errors and therefor the button is disabled.
The error:
Status ERROR: org.eclipse.core.databinding code=0 An error occurred while setting the value. java.lang.NullPointerException children=[Status ERROR: org.eclipse.core.databinding code=0 An error occurred while setting the value. java.lang.NullPointerException]
The same happens when I select another device.
A possible solution could be to set the tableSelection to the initial state when the app was started and no table entry is clicked yet. Is this possible?
Setting the tableViewer selection to StructuredSelection.EMPTY did not solve the problem.
Thanks for your help,
Mav