Mercurial > projects > dwt2
comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StatusToStringConverter.d @ 78:0a55d2d5a946
Added file for databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 14 Apr 2009 11:35:29 +0200 |
parents | |
children | 6be48cf9f95c |
comparison
equal
deleted
inserted
replaced
76:f05e6e8b2f2d | 78:0a55d2d5a946 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 ******************************************************************************/ | |
11 | |
12 module org.eclipse.core.internal.databinding.conversion.StatusToStringConverter; | |
13 | |
14 import java.lang.all; | |
15 | |
16 import org.eclipse.core.databinding.conversion.Converter; | |
17 import org.eclipse.core.databinding.conversion.IConverter; | |
18 import org.eclipse.core.runtime.IStatus; | |
19 | |
20 /** | |
21 * Converts an IStatus into a String. The message of the status is the returned value. | |
22 * | |
23 * @since 1.0 | |
24 */ | |
25 public class StatusToStringConverter : Converter , IConverter { | |
26 /** | |
27 * Constructs a new instance. | |
28 */ | |
29 public this() { | |
30 super(IStatus.classinfo, String.classinfo); | |
31 } | |
32 | |
33 /* (non-Javadoc) | |
34 * @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object) | |
35 */ | |
36 public Object convert(Object fromObject) { | |
37 if (fromObject is null) { | |
38 throw new IllegalArgumentException("Parameter 'fromObject' was null."); //$NON-NLS-1$ | |
39 } | |
40 | |
41 IStatus status = cast(IStatus) fromObject; | |
42 return status.getMessage(); | |
43 } | |
44 } |