Skip to main content



      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 07:35 Go to next message
Eclipse UserFriend
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 10: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: Thu Mar 13 13:10:17 EDT 2025

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

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

Back to the top