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.webbrowser.internal;
13 import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowser;
14 import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowser;
15 import net.sourceforge.phpeclipse.webbrowser.IWebBrowser;
17 import org.eclipse.jface.viewers.ILabelProviderListener;
19 import org.eclipse.swt.graphics.Image;
20 import org.eclipse.jface.viewers.ITableLabelProvider;
22 * Web browser table label provider.
24 public class BrowserTableLabelProvider implements ITableLabelProvider {
26 * BrowserTableLabelProvider constructor comment.
28 public BrowserTableLabelProvider() {
35 public void addListener(ILabelProviderListener listener) { }
40 public void dispose() { }
45 public Image getColumnImage(Object element, int columnIndex) {
46 if (columnIndex == 0) {
47 if (element instanceof IInternalWebBrowser)
48 return ImageResource.getImage(ImageResource.IMG_INTERNAL_BROWSER);
50 return ImageResource.getImage(ImageResource.IMG_EXTERNAL_BROWSER);
56 * Returns the label text for the given column of the given element.
58 * @param element the object representing the entire row, or
59 * <code>null</code> indicating that no input object is set
61 * @param columnIndex the zero-based index of the column in which the label appears
63 public String getColumnText(Object element, int columnIndex) {
64 IWebBrowser browser = (IWebBrowser)element;
65 if (browser instanceof IExternalWebBrowser) {
67 return notNull(((IExternalWebBrowser)browser).getName());
68 else if (columnIndex == 1)
69 return notNull(((IExternalWebBrowser)browser).getLocation());
70 else if (columnIndex == 2)
71 return notNull(((IExternalWebBrowser)browser).getParameters());
72 } else if(browser instanceof IInternalWebBrowser) {
74 return notNull(((IInternalWebBrowser)browser).getName());
79 protected String notNull(String s) {
89 public boolean isLabelProperty(Object element, String property) {
96 public void removeListener(ILabelProviderListener listener) { }