Open PHP Help Online Manual in the browser / add other http querie for google and...
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / preferences / ConfigurationTableLabelProvider.java
1 /**********************************************************************
2  * Copyright (c) 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7   *
8  * Contributors:
9  *    IBM - Initial API and implementation
10  **********************************************************************/
11 package net.sourceforge.phpdt.httpquery.preferences;
12
13 import net.sourceforge.phpdt.httpquery.config.IConfiguration;
14
15 import org.eclipse.jface.viewers.ILabelProviderListener;
16 import org.eclipse.jface.viewers.ITableLabelProvider;
17 import org.eclipse.swt.graphics.Image;
18
19 /**
20  * Configuration table label provider.
21  */
22 public class ConfigurationTableLabelProvider implements ITableLabelProvider {
23   /**
24    * ConfigurationTableLabelProvider constructor comment.
25    */
26   public ConfigurationTableLabelProvider() {
27     super();
28   }
29
30   /**
31    * Adds a listener to this label provider. Has no effect if an identical listener is already registered.
32    * <p>
33    * Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label
34    * provider.
35    * </p>
36    *
37    * @param listener
38    *          a label provider listener
39    */
40   public void addListener(ILabelProviderListener listener) {
41   }
42
43   /**
44    * Disposes of this label provider. When a label provider is attached to a viewer, the viewer will automatically call this method
45    * when the viewer is being closed. When label providers are used outside of the context of a viewer, it is the client's
46    * responsibility to ensure that this method is called when the provider is no longer needed.
47    */
48   public void dispose() {
49   }
50
51   /**
52    * Returns the label image for the given column of the given element.
53    *
54    * @param element
55    *          the object representing the entire row, or <code>null</code> indicating that no input object is set in the viewer
56    * @param columnIndex
57    *          the zero-based index of the column in which the label appears
58    */
59   public Image getColumnImage(Object element, int columnIndex) {
60     return null;
61   }
62
63   /**
64    * Returns the label text for the given column of the given element.
65    *
66    * @param element
67    *          the object representing the entire row, or <code>null</code> indicating that no input object is set in the viewer
68    * @param columnIndex
69    *          the zero-based index of the column in which the label appears
70    */
71   public String getColumnText(Object element, int columnIndex) {
72     IConfiguration configuration = (IConfiguration) element;
73     if (columnIndex == 0) {
74       return configuration.getName();
75     } else if (columnIndex == 1)
76       return configuration.getType();
77     else if (columnIndex == 2)
78       return configuration.getUser();
79     else if (columnIndex == 3)
80       return configuration.getURL();
81     else
82       return "X";
83   }
84
85   protected String notNull(String s) {
86     if (s != null)
87       return s;
88     else
89       return "";
90   }
91
92   /**
93    * Returns whether the label would be affected by a change to the given property of the given element. This can be used to
94    * optimize a non-structural viewer update. If the property mentioned in the update does not affect the label, then the viewer
95    * need not update the label.
96    *
97    * @param element
98    *          the element
99    * @param property
100    *          the property
101    * @return <code>true</code> if the label would be affected, and <code>false</code> if it would be unaffected
102    */
103   public boolean isLabelProperty(Object element, String property) {
104     return false;
105   }
106
107   /**
108    * Removes a listener to this label provider. Has no affect if an identical listener is not registered.
109    *
110    * @param listener
111    *          a label provider listener
112    */
113   public void removeListener(ILabelProviderListener listener) {
114   }
115 }