78
|
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;
|
81
|
13 import org.eclipse.core.internal.databinding.conversion.StringToBooleanPrimitiveConverter;
|
78
|
14
|
|
15 import java.lang.all;
|
|
16
|
|
17 /**
|
|
18 * StringToBooleanConverter.
|
|
19 */
|
|
20 public class StringToBooleanConverter : StringToBooleanPrimitiveConverter {
|
|
21
|
|
22 /*
|
|
23 * (non-Javadoc)
|
|
24 *
|
|
25 * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object)
|
|
26 */
|
|
27 public Object convert(Object source) {
|
|
28 String sourceString = cast(String) source;
|
|
29 if ("".equals(sourceString.trim())) { //$NON-NLS-1$
|
|
30 return null;
|
|
31 }
|
|
32 return super.convert(source);
|
|
33 }
|
|
34
|
|
35 public Object getToType() {
|
|
36 return Boolean.classinfo;
|
|
37 }
|
|
38
|
|
39 }
|