KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > LabelProvider


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  *******************************************************************************/

11 package org.eclipse.jface.viewers;
12
13 import org.eclipse.swt.graphics.Image;
14
15 /**
16  * A label provider implementation which, by default, uses an element's
17  * <code>toString</code> value for its text and <code>null</code> for its
18  * image.
19  * <p>
20  * This class may be used as is, or subclassed to provide richer labels.
21  * Subclasses may override any of the following methods:
22  * <ul>
23  * <li><code>isLabelProperty</code></li>
24  * <li><code>getImage</code></li>
25  * <li><code>getText</code></li>
26  * <li><code>dispose</code></li>
27  * </ul>
28  * </p>
29  */

30 public class LabelProvider extends BaseLabelProvider implements ILabelProvider {
31
32     /**
33      * Creates a new label provider.
34      */

35     public LabelProvider() {
36     }
37
38
39     /**
40      * The <code>LabelProvider</code> implementation of this
41      * <code>ILabelProvider</code> method returns <code>null</code>.
42      * Subclasses may override.
43      */

44     public Image getImage(Object JavaDoc element) {
45         return null;
46     }
47
48     /**
49      * The <code>LabelProvider</code> implementation of this
50      * <code>ILabelProvider</code> method returns the element's
51      * <code>toString</code> string. Subclasses may override.
52      */

53     public String JavaDoc getText(Object JavaDoc element) {
54         return element == null ? "" : element.toString();//$NON-NLS-1$
55
}
56 }
57
Popular Tags