deleteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) mTableView.getSelection();
if (selection!=null && !selection.isEmpty() && selection.size()==1)
{
final int selIdx = mTableView.getTable().getSelectionIndex();
List<MyModel> model = (List<MyModel>) mTableView.getInput();
model.remove(selection.getFirstElement());
mTableView.getTable().getDisplay().asyncExec(new Runnable()
{
public void run() {
mTableView.getTable().setSelection((selIdx > 0) ? (selIdx - 1) : 0);
mTableView.getTable().notifyListeners(SWT.Selection, new Event());
}
});
}
mTableView.refresh();
}
});
]]>