Bug 186250

Summary: [DataBinding] Adapt a label provider as an IConverter
Product: [Eclipse Project] Platform Reporter: Peter Centgraf <peter>
Component: UIAssignee: Boris Bokowski <bokowski>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: bradleyjames, qualidafial, tom.schindl
Version: 3.3   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Implementation of LabelProviderConverter none

Description Peter Centgraf CLA 2007-05-09 16:26:25 EDT
The various label provider interfaces in the JFace API can be thought of as specialized one-way converters from an arbitrary Object element to various types.

ILabelProvider => String, Image
IColorProvider => Color, Color
IFontProvider => Font

The attached patch adapts these provider interfaces to IConverter.  To support the common pattern where one provider object implements multiple of the interfaces, a static method is provided to wrap all supported conversions in a single call.

Please consider this patch for inclusion in the 3.4 API.
Comment 1 Peter Centgraf CLA 2007-05-09 16:27:57 EDT
Created attachment 66565 [details]
Implementation of LabelProviderConverter
Comment 2 Matthew Hall CLA 2009-02-10 16:47:23 EST
How about a read-only ConverterValueProperty instead?  Ideally there would also be a pre-convert validator provided to ensure that the master value can actually be converted.

IConverter doubleToCurrentConverter = ..
Double dollars = new Double(15);
IObservableValue BindingProperties.converter(doubleToCurrencyConverter)
    .observe( dollars );

This could prove to be a two in one solution for both this bug and bug 183031
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:13:14 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.