Mercurial > projects > dwt2
comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToBooleanConverter.d @ 78:0a55d2d5a946
Added file for databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 14 Apr 2009 11:35:29 +0200 |
parents | |
children | 383ce7bd736b |
comparison
equal
deleted
inserted
replaced
76:f05e6e8b2f2d | 78:0a55d2d5a946 |
---|---|
1 /* | |
2 * Copyright cast(C) 2005 db4objects Inc. http://www.db4o.com | |
3 * | |
4 * All rights reserved. This program and the accompanying materials | |
5 * are made available under the terms of the Eclipse Public License v1.0 | |
6 * which accompanies this distribution, and is available at | |
7 * http://www.eclipse.org/legal/epl-v10.html | |
8 * | |
9 * Contributors: | |
10 * db4objects - Initial API and implementation | |
11 */ | |
12 module org.eclipse.core.internal.databinding.conversion.StringToBooleanConverter; | |
13 | |
14 import java.lang.all; | |
15 | |
16 /** | |
17 * StringToBooleanConverter. | |
18 */ | |
19 public class StringToBooleanConverter : StringToBooleanPrimitiveConverter { | |
20 | |
21 /* | |
22 * (non-Javadoc) | |
23 * | |
24 * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object) | |
25 */ | |
26 public Object convert(Object source) { | |
27 String sourceString = cast(String) source; | |
28 if ("".equals(sourceString.trim())) { //$NON-NLS-1$ | |
29 return null; | |
30 } | |
31 return super.convert(source); | |
32 } | |
33 | |
34 public Object getToType() { | |
35 return Boolean.classinfo; | |
36 } | |
37 | |
38 } |