comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToDateValidator.d @ 85:6be48cf9f95c

Work on databinding
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 13:54:50 +0200
parents 0a55d2d5a946
children
comparison
equal deleted inserted replaced
84:fcf926c91ca4 85:6be48cf9f95c
41 * (non-Javadoc) 41 * (non-Javadoc)
42 * 42 *
43 * @see org.eclipse.core.databinding.validation.IValidator#validate(java.lang.Object) 43 * @see org.eclipse.core.databinding.validation.IValidator#validate(java.lang.Object)
44 */ 44 */
45 public IStatus validate(Object value) { 45 public IStatus validate(Object value) {
46 if ( null !is cast(String )value && (cast(String)value).trim().length() is 0) { 46 if ( null !is cast(ArrayWrapperString)value && (stringcast(value)).trim().length() is 0) {
47 return Status.OK_STATUS; 47 return Status.OK_STATUS;
48 } 48 }
49 Object convertedValue = converter.convert(value); 49 Object convertedValue = converter.convert(value);
50 //The StringToDateConverter returns null if it can't parse the date. 50 //The StringToDateConverter returns null if it can't parse the date.
51 if (convertedValue is null) { 51 if (convertedValue is null) {
73 samples.append("', "); //$NON-NLS-1$ 73 samples.append("', "); //$NON-NLS-1$
74 } 74 }
75 samples.append('\''); 75 samples.append('\'');
76 samples.append(util.format(sampleDate, 0)); 76 samples.append(util.format(sampleDate, 0));
77 samples.append('\''); 77 samples.append('\'');
78 return BindingMessages.getStringcast(BindingMessages.EXAMPLES) + ": " + samples + ",..."; //$NON-NLS-1$//$NON-NLS-2$ 78 return BindingMessages.getString(BindingMessages.EXAMPLES) ~ ": " ~ samples.toString() ~ ",..."; //$NON-NLS-1$//$NON-NLS-2$
79 } 79 }
80 80
81 private static class FormatUtil : DateConversionSupport { 81 private static class FormatUtil : DateConversionSupport {
82 /* 82 /*
83 * (non-Javadoc) 83 * (non-Javadoc)