btnInsertNewStaff
.setText("Insert new Staff elements into existing Measures");
btnInsertNewStaff
.setToolTipText("Insert new Staff elements into existing Measures");
m_bindingContext = new DataBindingContext();
table = new Table(grpStaffdefProperties, SWT.BORDER
| SWT.FULL_SELECTION);
table.setBounds(10, 15, 312, 193);
table.setLinesVisible(true);
table.setHeaderVisible(true);
// see mysteriousTableViewer
tableViewer = new TableViewer(table);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
TableViewerColumn clefShapeColumn = new TableViewerColumn(tableViewer,
SWT.BORDER);
clefShapeColumn.getColumn().setText("Clefshape");
clefShapeColumn.getColumn().setToolTipText("Clefshape help");
clefShapeColumn.getColumn().setWidth(100);
TableViewerColumn keySigColumn = new TableViewerColumn(tableViewer,
SWT.BORDER);
keySigColumn.getColumn().setText("KeySig");
keySigColumn.getColumn().setToolTipText("KeySig help");
keySigColumn.getColumn().setWidth(100);
TableViewerColumn meterCountColumn = new TableViewerColumn(tableViewer,
SWT.BORDER);
meterCountColumn.getColumn().setText("MeterCount");
meterCountColumn.getColumn().setToolTipText("MeterCount help");
meterCountColumn.getColumn().setWidth(55);
TableViewerColumn meterUnitColumn = new TableViewerColumn(tableViewer,
SWT.BORDER);
meterUnitColumn.getColumn().setText("MeterUnit");
meterUnitColumn.getColumn().setToolTipText("MeterUnit help");
meterUnitColumn.getColumn().setWidth(55);
tableViewer.setLabelProvider(new ITableLabelProvider() {
@Override
public void addListener(ILabelProviderListener listener) {
}
@Override
public void dispose() {
}
@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
@Override
public String getColumnText(Object element, int columnIndex) {
switch (columnIndex) {
case 0:
return ((InsertStaffDefsDialogEntryWrapper) element)
.getClefShape().name();
case 1:
return ((InsertStaffDefsDialogEntryWrapper) element)
.getKeySigValue();
case 2:
return ((InsertStaffDefsDialogEntryWrapper) element)
.getMeterCount();
case 3:
return ((InsertStaffDefsDialogEntryWrapper) element)
.getMeterUnit();
default:
return element.toString();
}
}
@Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
@Override
public void removeListener(ILabelProviderListener listener) {
}
});
tableViewer.setContentProvider(new ObservableListContentProvider());
tableViewer.setInput(writableList);
DataBindingContext ctx = new DataBindingContext();
meterUnitColumn.setEditingSupport(new ObservableValueEditingSupport(
tableViewer, ctx) {
private TextCellEditor textEditor;