.getSelectionIndex()));
}
}
});
sc.addFormControlListener(new FormControlAdapter() {
public void changed(FormControl control) {
if (sc.isSuccessful()) {
if (sc.isMultiple()) {
String[] values = sc.getMultipleValues();
int[] indices = new int[values.length];
for (int i = 0; i < values.length; i++) {
indices[i] = _values.indexOf(values[i]);
}
list.setSelection(indices);
} else {
list.setSelection(_values.indexOf(sc.getValue()));
}
} else {
list.deselectAll();
}
}
public void successful(FormControl control) {
changed(control);
}
});
if (sc.isSuccessful()) {
if (sc.isMultiple()) {
String[] values = sc.getMultipleValues();
int[] indices = new int[values.length];
for (int i = 0; i < values.length; i++) {
indices[i] = _values.indexOf(values[i]);
}
list.setSelection(indices);
} else {
list.setSelection(_values.indexOf(sc.getValue()));
}
}
return list;
} else {
_combo = true;
final Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setItems((String[]) _labels
.toArray(new String[_labels.size()]));
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int selection = combo.getSelectionIndex();
if (selection < 0) {
sc.setSuccessful(false);
} else {
sc.setValue((String) _values.get(selection));
}
}
});
sc.addFormControlListener(new FormControlAdapter() {
public void changed(FormControl control) {
if (sc.isSuccessful()) {
combo.select(_values.indexOf(sc.getValue()));
} else {
combo.deselectAll();