I have a JFaceTableViewer with many rows. These rows I have previously fetched by using JPA. I have put the fetching in another thread to show a progress while fetching and it works.
Now I have put an SelectionAdapter on each of the columns to allow sorting on that column. Here is the code:
private SelectionAdapter getSelectionAdapter(final TableColumn column, final String colName) {
SelectionAdapter selectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
comparator.setColumnName(colName);
int dir = comparator.getDirection();
resultTableViewer.getTable().setSortDirection(dir);
resultTableViewer.getTable().setSortColumn(column);
resultTableViewer.refresh();
}
};
return selectionAdapter;
}
How can I execute these lines for sorting in another thread to show a progressbar? Everytime I try to call methods on resultTableViewer I got the exception: InvalidThreadAccess
Any ideas???