Mercurial > projects > dwt-addons
annotate dwtx/jface/viewers/NamedHandleObjectLabelProvider.d @ 43:ea8ff534f622
Fix override and super aliases
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 11 Apr 2008 01:24:25 +0200 |
parents | b6c35faf97c8 |
children | 46a6e0e6ccd4 |
rev | line source |
---|---|
10 | 1 /******************************************************************************* |
2 * Copyright (c) 2005 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 | |
14 module dwtx.jface.viewers.NamedHandleObjectLabelProvider; | |
15 | |
16 import dwtx.jface.viewers.DialogCellEditor; | |
17 import dwtx.jface.viewers.LabelProvider; | |
18 | |
19 | |
20 import dwtx.core.commands.common.NamedHandleObject; | |
21 import dwtx.core.commands.common.NotDefinedException; | |
22 | |
23 import dwt.dwthelper.utils; | |
24 | |
25 /** | |
26 * A label provider for instances of <code>NamedHandlerObject</code>, which | |
27 * exposes the name as the label. | |
28 * | |
29 * @since 3.2 | |
30 */ | |
31 public final class NamedHandleObjectLabelProvider : LabelProvider { | |
32 | |
33 /** | |
34 * The text of the element is simply the name of the element if its a | |
35 * defined instance of <code>NamedHandleObject</code>. Otherwise, this | |
36 * method just returns <code>null</code>. | |
37 * | |
38 * @param element | |
39 * The element for which the text should be retrieved; may be | |
40 * <code>null</code>. | |
41 * @return the name of the handle object; <code>null</code> if there is no | |
42 * name or if the element is not a named handle object. | |
43 */ | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
44 public override final String getText(Object element) { |
10 | 45 if ( cast(NamedHandleObject)element ) { |
46 try { | |
47 return (cast(NamedHandleObject) element).getName(); | |
48 } catch (NotDefinedException e) { | |
49 return null; | |
50 } | |
51 } | |
52 | |
53 return null; | |
54 } | |
55 } |