문제

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

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top