On Tue, Aug 4, 2015 at 6:19 PM, Emmanuel Lécharny <elecharny@gmail.com> wrote:
Hi,

a Text widget does not accept null values. It forces us to test if the
value is null, and if so, we inject a "".
how about extending the TextWidget to make this automatically happen?
(not sure whether there is any practical limitation for doing this in SWT)

I'm willing to add a method in common-ui CommonUIUtils class that do
this check instead of having to test that all over the code. May be
tehre is already such a method spmewhere else ?

Here is what I want to add :



    /**
     * An utility method that return a String which is never null.
     *
     * @param value The incoming value, which can be null
     * @return The String if it's not null, "" otherwise
     */
    public static String getTextvalue( String value )
    {
        if ( value == null )
        {
            return "";
        }
        else
        {
            return value;
        }
    }

Dead simple...

Let me konw if it's ok.

Thanks !



--
Kiran Ayyagari
http://keydap.com