01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.viewers;
11:
12: import org.eclipse.swt.graphics.Image;
13:
14: /**
15: * A label provider implementation which, by default, uses an element's
16: * <code>toString</code> value for its text and <code>null</code> for its
17: * image.
18: * <p>
19: * This class may be used as is, or subclassed to provide richer labels.
20: * Subclasses may override any of the following methods:
21: * <ul>
22: * <li><code>isLabelProperty</code></li>
23: * <li><code>getImage</code></li>
24: * <li><code>getText</code></li>
25: * <li><code>dispose</code></li>
26: * </ul>
27: * </p>
28: */
29: public class LabelProvider extends BaseLabelProvider implements
30: ILabelProvider {
31:
32: /**
33: * Creates a new label provider.
34: */
35: public LabelProvider() {
36: }
37:
38: /**
39: * The <code>LabelProvider</code> implementation of this
40: * <code>ILabelProvider</code> method returns <code>null</code>.
41: * Subclasses may override.
42: */
43: public Image getImage(Object element) {
44: return null;
45: }
46:
47: /**
48: * The <code>LabelProvider</code> implementation of this
49: * <code>ILabelProvider</code> method returns the element's
50: * <code>toString</code> string. Subclasses may override.
51: */
52: public String getText(Object element) {
53: return element == null ? "" : element.toString();//$NON-NLS-1$
54: }
55: }
|