How do you get a data reference from an SWT Combo drop list? Currently I need to get the text from the Combo box, then run through my data objects until I reach one that has the same text as what the Combo box reports.
Combo combo = new Combo( new Shell(), SWT.READ_ONLY );
for (Person person : People.getPeople())
combo.add( person.getName() );
for (Person person : People.getPeople())
if (combo.getText().equals( person.getName() ))
System.out.println( "Person: " + person.getFullName() );
While this works, it is prone to various errors, and also CPU intensive especially for large lists. I really wish that a Combo would had "setData()" and "getData()" methods for each Combo item.