public void handleEvent(Event event) {
if (event.widget.equals(set)) {
String name = columnName.getText();
String type = columnType.getText();
Set<COLUMN> cols = (Set<COLUMN>) viewer.getInput();
COLUMN col = new COLUMN(name, type);
cols.remove(col);
cols.add(col);
viewer.setInput(cols);
}
else if (event.widget.equals(delete)) {
TableItem[] items = viewer.getTable().getSelection();
if (items.length > 0) {
Set<COLUMN> cols = (Set<COLUMN>) viewer.getInput();
COLUMN col = (COLUMN)items[0].getData();
cols.remove(col);
viewer.setInput(cols);
}
}
else if (event.widget instanceof Table) {
TableItem[] items = ((Table)event.widget).getSelection();
if (items.length > 0) {
COLUMN col = (COLUMN)items[0].getData();
columnName.setText(col.name);
columnType.setText(col.type);
}
}
}