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
9 * IBM - Initial API and implementation
10 **********************************************************************/
11 package net.sourceforge.phpdt.httpquery.preferences;
13 import net.sourceforge.phpdt.httpquery.config.IConfiguration;
15 import org.eclipse.jface.viewers.ILabelProviderListener;
16 import org.eclipse.jface.viewers.ITableLabelProvider;
17 import org.eclipse.swt.graphics.Image;
20 * Configuration table label provider.
22 public class ConfigurationTableLabelProvider implements ITableLabelProvider {
24 * ConfigurationTableLabelProvider constructor comment.
26 public ConfigurationTableLabelProvider() {
31 * Adds a listener to this label provider. Has no effect if an identical listener is already registered.
33 * Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label
38 * a label provider listener
40 public void addListener(ILabelProviderListener listener) {
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.
48 public void dispose() {
52 * Returns the label image for the given column of the given element.
55 * the object representing the entire row, or <code>null</code> indicating that no input object is set in the viewer
57 * the zero-based index of the column in which the label appears
59 public Image getColumnImage(Object element, int columnIndex) {
64 * Returns the label text for the given column of the given element.
67 * the object representing the entire row, or <code>null</code> indicating that no input object is set in the viewer
69 * the zero-based index of the column in which the label appears
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();
85 protected String notNull(String s) {
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.
101 * @return <code>true</code> if the label would be affected, and <code>false</code> if it would be unaffected
103 public boolean isLabelProperty(Object element, String property) {
108 * Removes a listener to this label provider. Has no affect if an identical listener is not registered.
111 * a label provider listener
113 public void removeListener(ILabelProviderListener listener) {