Bug 186250 - [DataBinding] Adapt a label provider as an IConverter
Summary: [DataBinding] Adapt a label provider as an IConverter
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-09 16:26 EDT by Peter Centgraf CLA
Modified: 2019-09-06 16:13 EDT (History)
3 users (show)

See Also:


Attachments
Implementation of LabelProviderConverter (4.85 KB, application/octet-stream)
2007-05-09 16:27 EDT, Peter Centgraf CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.