• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TableViewer -> Deselecting selected tableItems.

Nodon Darkeye
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Afternoon fellow coders,

I'm a junior java developer who recently started working (first job).
I've been consulting coderanch for a few months now but never posted anything myself.
Time to change that with this questing.

I'm working on an eclipse plugin in which I'm using a TableViewer and it's table hold the name of multiple files.
I construct the Viewer like this:

People should only be able to select one item at a time (so SWT.SINGLE), SWT.MULTI has this nice feature where you can do "crtl"+click
to deselect a selected item. I would like to have a simular feature for my table and I want that deselecting also triggers some other things of my choosing.
At the moment I add my Listener like this:

Basicaly I'm checking if the item which is selected now is the same as the one selected before.
If not do something, if so setSelection(StructuredSelection.EMPTY).
Sadly enough at this moment i'm trying to set the selection during the handling of the "selection"-event.
It briefly deselects the TableItem to then reselect it again. I assume this is because of a mechanism that is activated after finishing the event handling.

I've been looking for a few hours and haven't been able to find a solution for my problem, so all help and suggestions are welcome!

Kind Regards,

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic