private static void createPostalAddress(CompositeEditor editor,
final Binding binding) {
OneLineTextElement<String> t = new OneLineTextElement<String>() {
protected void setValue(IBinding binding, Object value) {
if (value instanceof PostalAddress) {
PostalAddress c = (PostalAddress) value;
super.setValue(binding, c.getAddress());
}
}
protected void doCommit(final IBinding binding2) {
commitToBinding(new PostalAddress(getText()));
}
};
t.setContentAssistLabelProvider(new LabelProvider() {
public String getText(Object element) {
if (element == null) {
return "";
}
if (element instanceof PostalAddress) {
PostalAddress m = (PostalAddress) element;
return m.getAddress();
}
return element.toString();
}
});