Mercurial > projects > dwt2
annotate org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StatusToStringConverter.d @ 88:9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 19 Apr 2009 11:10:09 +0200 |
parents | 6be48cf9f95c |
children |
rev | line source |
---|---|
78 | 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 { | |
85 | 26 public override Object getFromType() { |
27 return super.getFromType(); | |
28 } | |
29 public override Object getToType() { | |
30 return super.getToType(); | |
31 } | |
78 | 32 /** |
33 * Constructs a new instance. | |
34 */ | |
35 public this() { | |
88
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
85
diff
changeset
|
36 super(Class.fromType!(IStatus), Class.fromType!(StringCls)); |
78 | 37 } |
38 | |
39 /* (non-Javadoc) | |
40 * @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object) | |
41 */ | |
42 public Object convert(Object fromObject) { | |
43 if (fromObject is null) { | |
44 throw new IllegalArgumentException("Parameter 'fromObject' was null."); //$NON-NLS-1$ | |
45 } | |
46 | |
47 IStatus status = cast(IStatus) fromObject; | |
85 | 48 return stringcast(status.getMessage()); |
78 | 49 } |
50 } |