comparison org.eclipse.jface/src/org/eclipse/jface/viewers/IBaseLabelProvider.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
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 org.eclipse.jface.viewers.IBaseLabelProvider;
14
15 import org.eclipse.jface.viewers.ILabelProviderListener;
16
17 import java.lang.all;
18
19 /**
20 * A label provider maps an element of the viewer's model to
21 * an optional image and optional text string used to display
22 * the element in the viewer's control. Certain label providers
23 * may allow multiple labels per element.
24 * This is an "abstract interface", defining methods common
25 * to all label providers, but does not actually define the methods
26 * to get the label(s) for an element. This interface should never
27 * be directly implemented.
28 * Most viewers will take either an <code>ILabelProvider</code> or
29 * an <code>ITableLabelProvider</code>.
30 * <p>
31 * A label provider must not be shared between viewers
32 * since a label provider generally manages SWT resources (images),
33 * which must be disposed when the viewer is disposed.
34 * To simplify life cycle management, the current label provider
35 * of a viewer is disposed when the viewer is disposed.
36 * </p>
37 * <p>
38 * Label providers can be used outside the context of viewers wherever
39 * images are needed. When label providers are used in this fashion
40 * it is the responsibility of the user to ensure <code>dispose</code>
41 * is called when the provider is no longer needed.
42 * </p>
43 *
44 * @see ILabelProvider
45 * @see ITableLabelProvider
46 */
47 public interface IBaseLabelProvider {
48 /**
49 * Adds a listener to this label provider.
50 * Has no effect if an identical listener is already registered.
51 * <p>
52 * Label provider listeners are informed about state changes
53 * that affect the rendering of the viewer that uses this label provider.
54 * </p>
55 *
56 * @param listener a label provider listener
57 */
58 public void addListener(ILabelProviderListener listener);
59
60 /**
61 * Disposes of this label provider. When a label provider is
62 * attached to a viewer, the viewer will automatically call
63 * this method when the viewer is being closed. When label providers
64 * are used outside of the context of a viewer, it is the client's
65 * responsibility to ensure that this method is called when the
66 * provider is no longer needed.
67 */
68 public void dispose();
69
70 /**
71 * Returns whether the label would be affected
72 * by a change to the given property of the given element.
73 * This can be used to optimize a non-structural viewer update.
74 * If the property mentioned in the update does not affect the label,
75 * then the viewer need not update the label.
76 *
77 * @param element the element
78 * @param property the property
79 * @return <code>true</code> if the label would be affected,
80 * and <code>false</code> if it would be unaffected
81 */
82 public bool isLabelProperty(Object element, String property);
83
84 /**
85 * Removes a listener to this label provider.
86 * Has no affect if an identical listener is not registered.
87 *
88 * @param listener a label provider listener
89 */
90 public void removeListener(ILabelProviderListener listener);
91 }