My question is How can we find the currently selected column number in the selected row of a SWT Table in Eclipse RCP?
Inside a Listener
- e.g. for SWT.Selection
- you can use viewer.getCell(...)
as illustrated in the following example:
myTableViewer.getTable().addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
Point p = new Point(event.x, event.y);
ViewerCell cell = myTableViewer.getCell(p);
int columnIndex = cell.getColumnIndex();
//...
}
});