// @todo there is a problem on windows that results in editable combo viewers behaving incorrectly.
// @todo this will be fixed.
//int style = editable ? SWT.DROP_DOWN : (SWT.READ_ONLY | SWT.DROP_DOWN);
int style = (SWT.READ_ONLY | SWT.DROP_DOWN);
final ComboViewer combo =
new ComboViewer(controlDetails.attributesComposite, style,
items);
controlDetails.attributesComposite.
setData(controlDetails.attribute, combo);
combo.setData(AttributesComposite.ATTRIBUTE_ACCESSOR_KEY,
new AttributesComposite.AttributeAccessor() {
public String getValue(String attribute) {
return (String) combo.getValue();
}
public void setValue(String attribute, String value) {
combo.getCombo().deselectAll();
combo.setValue(value);
}
});
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Object oldValue = null;
Object newValue = combo.getValue();
PropertyChangeEvent propertyChange = new PropertyChangeEvent(
combo, controlDetails.attribute, oldValue, newValue);
controlDetails.attributesComposite.
propertyChange(propertyChange);
}
});
// Add an accessible listener
addAccessibleListener(combo, controlDetails);
GridData comboGridData = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(comboGridData);
combo.setData(ATTRIBUTE_NAME_KEY, controlDetails.attribute);
associateHandlerWithCombo(controlDetails.handler, combo.getCombo());
}