tableViewer.setContentProvider(new ObservableListContentProvider());
tableViewer.setInput(writableList);
DataBindingContext ctx = new DataBindingContext();
meterUnitColumn.setEditingSupport(new ObservableValueEditingSupport(
tableViewer, ctx) {
private TextCellEditor textEditor;
@Override
protected IObservableValue doCreateCellEditorObservable(
CellEditor cellEditor) {
return SWTObservables.observeText(cellEditor.getControl(),
SWT.Modify);
}
@Override
protected IObservableValue doCreateElementObservable(
Object element, ViewerCell cell) {
return BeansObservables.observeValue(element, "meterUnit");
}
@Override
protected CellEditor getCellEditor(Object element) {
if (textEditor == null) {
textEditor = new TextCellEditor((Composite) tableViewer
.getControl());
tableViewer.getColumnViewerEditor()
.addEditorActivationListener(
columnViewerActivationListener);
}
return textEditor;
}
});
meterCountColumn.setEditingSupport(new ObservableValueEditingSupport(
tableViewer, ctx) {
private TextCellEditor textEditor;
@Override
protected IObservableValue doCreateCellEditorObservable(
CellEditor cellEditor) {
return SWTObservables.observeText(cellEditor.getControl(),
SWT.Modify);
}
@Override
protected IObservableValue doCreateElementObservable(
Object element, ViewerCell cell) {
return BeansObservables.observeValue(element, "meterCount");
}
@Override
protected CellEditor getCellEditor(Object element) {
if (textEditor == null) {
textEditor = new TextCellEditor((Composite) tableViewer
.getControl());
tableViewer.getColumnViewerEditor()
.addEditorActivationListener(
columnViewerActivationListener);
}
return textEditor;
}
});
clefShapeColumn.setEditingSupport(new ObservableValueEditingSupport(
tableViewer, ctx) {
private ComboBoxViewerCellEditor cellEditor;
@Override
protected IObservableValue doCreateCellEditorObservable(
CellEditor cellEditor) {
return ViewersObservables
.observeSingleSelection(((ComboBoxViewerCellEditor) cellEditor)
.getViewer());
}
@Override
protected IObservableValue doCreateElementObservable(
Object element, ViewerCell cell) {
return BeansObservables.observeValue(element, "clefShape");
}
@Override
protected CellEditor getCellEditor(Object element) {
if (cellEditor == null) {
cellEditor = new ComboBoxViewerCellEditor(
(Composite) tableViewer.getControl());
cellEditor.setContentProvider(new ArrayContentProvider());
cellEditor.setLabelProvider(new LabelProvider());
cellEditor.setInput(DataCLEFSHAPE.values());
tableViewer.getColumnViewerEditor()
.addEditorActivationListener(
columnViewerActivationListener);
}
return cellEditor;
}
});
keySigColumn.setEditingSupport(new ObservableValueEditingSupport(
tableViewer, ctx) {
private ComboBoxViewerCellEditor cellEditor;
@Override
protected IObservableValue doCreateCellEditorObservable(