String firstName = EditorMessages.getString(RESOURCE_PREFIX +
identifier.getName() + ".first.label");
String secondName = EditorMessages.getString(RESOURCE_PREFIX +
identifier.getName() + ".second.label");
final StylePairEditor styleEditor = new StylePairEditor(this,
SWT.NONE, styleProperty, pairType, true, context,
firstName, secondName);
data = new GridData(GridData.FILL_HORIZONTAL |
GridData.GRAB_HORIZONTAL);
data.verticalSpan = 2;
data.horizontalSpan = 2;
styleEditor.setLayoutData(data);
// Add the accessors for the values represented by this pair editor.
accessors.put(identifier, new PropertyAccessor() {
public Object getPropertyValue() {
String textValue = styleEditor.getStringValue();
final EditorPropertyParser parser = new EditorPropertyParser();
return parser.parsePropertyValue(styleProperty, textValue,
styleEditor.isImportant());
}
public void setPropertyValue(Object newValue) {
if (newValue instanceof PropertyValue) {
styleEditor.setValue((PropertyValue) newValue);
} else {
styleEditor.setValue(null);
}
}
});
// Add a modification listener.
styleEditor.addModifyListener(
new ModifyListener() {
public void modifyText(ModifyEvent event) {
propertyChanged(descriptor, styleEditor.getValues());
}
}
);
// Update the list of controls managed by this composite.