]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/gallery/ILabelProvider.java
Fixed invalid comparisons which were identified by Eclipse IDE 2018-09
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / gallery / ILabelProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.gallery;
13
14 import org.eclipse.jface.viewers.IBaseLabelProvider;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.graphics.Color;
17 import org.simantics.g2d.image.Image;
18
19 public interface ILabelProvider extends IBaseLabelProvider {
20     /**
21      * Returns the image for the label of the given element.  The image
22      * is owned by the label provider and must not be disposed directly.
23      * Instead, dispose the label provider when no longer needed.
24      *
25      * @param element the element for which to provide the label image
26      * @return the image used to label the element, or <code>null</code>
27      *   if there is no image for the given object
28      */
29     public Image getImage(Object element);
30
31     /**
32      * Returns the text for the label of the given element.
33      *
34      * @param element the element for which to provide the label text
35      * @return the text string used to label the element, or <code>null</code>
36      *   if there is no text label for the given object
37      */
38     public String getText(Object element);
39     
40     /**
41          * Get the image displayed in the tool tip for object.
42          * 
43          * <p>
44          * <b>If {@link #getToolTipText(Object)} and
45          * {@link #getToolTipImage(Object)} both return <code>null</code> the
46          * control is set back to standard behavior</b>
47          * </p>
48          * 
49          * @param object
50          *            the element for which the tool tip is shown
51          * @return {@link Image} or <code>null</code> if there is not image.
52          */
53
54         public java.awt.Image getToolTipImage(Object object);
55         
56         /**
57          * Get the text displayed in the tool tip for object.
58          * 
59          * <p>
60          * <b>If {@link #getToolTipText(Object)} and
61          * {@link #getToolTipImage(Object)} both return <code>null</code> the
62          * control is set back to standard behavior</b>
63          * </p>
64          * 
65          * @param element
66          *            the element for which the tool tip is shown
67          * @return the {@link String} or <code>null</code> if there is not text to
68          *         display
69          */
70         public String getToolTipText(Object element);
71         
72         /**
73          * Return the background color used for the tool tip
74          * 
75          * @param object
76          *            the {@link Object} for which the tool tip is shown
77          * 
78          * @return the {@link Color} used or <code>null</code> if you want to use
79          *         the default color {@link SWT#COLOR_INFO_BACKGROUND}
80          * @see SWT#COLOR_INFO_BACKGROUND
81          */
82         public Color getToolTipBackgroundColor(Object object);
83         
84         /**
85          * The foreground color used to display the the text in the tool tip
86          * 
87          * @param object
88          *            the {@link Object} for which the tool tip is shown
89          * @return the {@link Color} used or <code>null</code> if you want to use
90          *         the default color {@link SWT#COLOR_INFO_FOREGROUND}
91          * @see SWT#COLOR_INFO_FOREGROUND
92          */
93         public Color getToolTipForegroundColor(Object object);
94
95 }