Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [databinding] Globally convert all empty strings to null
[databinding] Globally convert all empty strings to null [message #327803] Fri, 02 May 2008 11:35 Go to next message
Jason Kusnier is currently offline Jason KusnierFriend
Messages: 10
Registered: July 2009
Junior Member
With databinding is there a way to have it default convert all empty
strings to null? I know I can do this with a converter, but I would need
to attach it to every binding. Any help would be greatly appreciated.
Re: [databinding] Globally convert all empty strings to null [message #327809 is a reply to message #327803] Fri, 02 May 2008 14:14 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Jason Kusnier wrote:
> With databinding is there a way to have it default convert all empty
> strings to null? I know I can do this with a converter, but I would
> need to attach it to every binding. Any help would be greatly appreciated.
>

You can do it in a custom UpdateValueStrategy by either setting the
IConverter or overriding createConverter(Object fromType, Object toType)
You'll still face the problem of getting that UpdateValueStrategy used
on all your bindings. One way to do that is to funnel all binding
creation through a single place; another approach is to create a custom
DataBindingContext and override bindValue() so that it uses your custom
UpdateValueStrategy as the default (when null is passed in).

There might be another way to globally apply a strategy or converter,
but these are the options I know about.

Hope this helps,
Eric
Previous Topic:extending java builder in eclipse?
Next Topic:Is there something such as a Jface Viewer CheckStateProvider
Goto Forum:
  


Current Time: Sun Jun 30 13:48:08 GMT 2024

Powered by FUDForum. Page generated in 0.03111 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top