protected void addTerms(List<T> preferredTerms) {
terms = new ArrayList<T>();
+ Collections.sort(preferredTerms, termComparator);
if(addEmptyElement){
// Add an empty element for when nothing was selected yet
combo.add(EMPTY_ELEMENT_LABEL);
// terms.add(emptyElement);
}
List<T> withoutNull = new ArrayList<>(terms);
+
if (termComparator != null) {
if (addEmptyElement){
withoutNull = terms.subList(1, terms.size());
}
- Collections.sort(withoutNull, termComparator);
+// Collections.sort(withoutNull, termComparator);
+
}
for (T term : withoutNull) {
String label = getLabel(term);
@Override
public void widgetSelected(SelectionEvent e) {
if (e.getSource().equals(combo) && combo.getSelectionIndex() >= 0){
+ int index = combo.getSelectionIndex();
selection = terms.get(combo.getSelectionIndex());
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
}