• Post Reply Bookmark Topic Watch Topic
  • New Topic

table selection in SWT  RSS feed

 
Stoonqtes halazoonates
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I created a table viewer, and I set the input to an ArrayList where I have my object
How can I do to retrieve the selected object in the table.

thank you very much
 
Stoonqtes halazoonates
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found it

ISelection selection = view.getSite().getSelectionProvider()
.getSelection();
List<Person> personList = new ArrayList<Person>();
if (selection != null && selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) selection;
for (Iterator<Person> iterator = sel.iterator(); iterator.hasNext();) {
Person person = (Person) iterator.next();
personList.add(person);
}
}


thanks
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!