Question

I’m using JFace viewer Framework in my eclipse rcp application, I’ve created a Table Viewer, which populates some data .My view has a refresh button below tableviewer, when I select a row in tableviewer and trigger refresh button the selected row still appears in gray color.
Scenario is depicted below
Before selecting a row
Before selecting row
After selecting a row
After selecting a row
After refresh
After refresh
In what way can i remove the gray background as in the above figure and make it as 1st image. My refresh button listener code is simple which has

viewer.refresh();

as a workaround i tried implementing methods like

viewer.getTable().redraw();
viewer.getTable().setRedraw(true); 

which doesn't work, is there a solution to refresh it or should I refresh the view totally
Note: My Execution environment is windows xp

Était-ce utile?

La solution

That gray line is current, not previous selection. It's gray because table is not in focus. Use setSelection(StructuredSelection.EMPTY).

Autres conseils

If you create the table with the style flag SWT.HIDE_SELECTION the table will not show its selection when it loses focus. I.e. it will look like your first image.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top