viewer.setInput(userFilters);
buttonNew.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
GeneralMatchingFilter newFilter = GeneralMatchingFilterDialog.createNewFilter(parent.getShell());
if (newFilter != null) {
userFilters.add(newFilter);
viewer.refresh();
}
}
});
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateButtonStates();
}
});
buttonEdit.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// should be safe to assume that selection is exactly 1 item
TableItem selectedItem = table.getSelection()[0];
Object selectedObject = selectedItem.getData();
GeneralMatchingFilter filter = (GeneralMatchingFilter) selectedObject;
GeneralMatchingFilterDialog.editFilter(parent.getShell(), filter);
updateButtonStates();
viewer.refresh();
}
});