10
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2006 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 module dwtx.jface.viewers.LabelProvider;
|
|
14
|
|
15 import dwtx.jface.viewers.BaseLabelProvider;
|
|
16 import dwtx.jface.viewers.ILabelProvider;
|
|
17
|
|
18 import dwt.graphics.Image;
|
|
19
|
|
20 import dwt.dwthelper.utils;
|
|
21
|
|
22 /**
|
|
23 * A label provider implementation which, by default, uses an element's
|
|
24 * <code>toString</code> value for its text and <code>null</code> for its
|
|
25 * image.
|
|
26 * <p>
|
|
27 * This class may be used as is, or subclassed to provide richer labels.
|
|
28 * Subclasses may override any of the following methods:
|
|
29 * <ul>
|
|
30 * <li><code>isLabelProperty</code></li>
|
|
31 * <li><code>getImage</code></li>
|
|
32 * <li><code>getText</code></li>
|
|
33 * <li><code>dispose</code></li>
|
|
34 * </ul>
|
|
35 * </p>
|
|
36 */
|
|
37 public class LabelProvider : BaseLabelProvider, ILabelProvider {
|
|
38
|
|
39 /**
|
|
40 * Creates a new label provider.
|
|
41 */
|
|
42 public this() {
|
|
43 }
|
|
44
|
|
45
|
|
46 /**
|
|
47 * The <code>LabelProvider</code> implementation of this
|
|
48 * <code>ILabelProvider</code> method returns <code>null</code>.
|
|
49 * Subclasses may override.
|
|
50 */
|
|
51 public Image getImage(Object element) {
|
|
52 return null;
|
|
53 }
|
|
54
|
|
55 /**
|
|
56 * The <code>LabelProvider</code> implementation of this
|
|
57 * <code>ILabelProvider</code> method returns the element's
|
|
58 * <code>toString</code> string. Subclasses may override.
|
|
59 */
|
|
60 public String getText(Object element) {
|
|
61 return element is null ? "" : element.toString();//$NON-NLS-1$
|
|
62 }
|
|
63 }
|