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.phpeclipse.wiki.ui.internal;
13 import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
14 import net.sourceforge.phpeclipse.wiki.internal.IConfiguration;
16 import org.eclipse.jface.viewers.ILabelProviderListener;
17 import org.eclipse.jface.viewers.ITableLabelProvider;
18 import org.eclipse.swt.graphics.Image;
21 * Configuration table label provider.
23 public class ConfigurationTableLabelProvider implements ITableLabelProvider {
25 * ConfigurationTableLabelProvider constructor comment.
27 public ConfigurationTableLabelProvider() {
32 * Adds a listener to this label provider. Has no effect if an identical listener is already registered.
34 * Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label
39 * a label provider listener
41 public void addListener(ILabelProviderListener listener) {
45 * Disposes of this label provider. When a label provider is attached to a viewer, the viewer will automatically call this method
46 * when the viewer is being closed. When label providers are used outside of the context of a viewer, it is the client's
47 * responsibility to ensure that this method is called when the provider is no longer needed.
49 public void dispose() {
53 * Returns the label image for the given column of the given element.
56 * the object representing the entire row, or <code>null</code> indicating that no input object is set in the viewer
58 * the zero-based index of the column in which the label appears
60 public Image getColumnImage(Object element, int columnIndex) {
65 * Returns the label text for the given column of the given element.
68 * the object representing the entire row, or <code>null</code> indicating that no input object is set in the viewer
70 * the zero-based index of the column in which the label appears
72 public String getColumnText(Object element, int columnIndex) {
73 IConfiguration monitor = (IConfiguration) element;
74 if (columnIndex == 0) {
75 return monitor.getName();
76 } else if (columnIndex == 1)
77 return monitor.getType();
78 else if (columnIndex == 2)
79 return monitor.getUser();
80 else if (columnIndex == 3)
81 return monitor.getURL();
86 protected String notNull(String s) {
94 * Returns whether the label would be affected by a change to the given property of the given element. This can be used to
95 * optimize a non-structural viewer update. If the property mentioned in the update does not affect the label, then the viewer
96 * need not update the label.
102 * @return <code>true</code> if the label would be affected, and <code>false</code> if it would be unaffected
104 public boolean isLabelProperty(Object element, String property) {
109 * Removes a listener to this label provider. Has no affect if an identical listener is not registered.
112 * a label provider listener
114 public void removeListener(ILabelProviderListener listener) {