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;
18 import org.eclipse.jface.viewers.ITableLabelProvider;
19 import org.eclipse.swt.graphics.Image;
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) {
41 public void dispose() {
47 public Image getColumnImage(Object element, int columnIndex) {
48 if (columnIndex == 0) {
49 if (element instanceof IInternalWebBrowser)
51 .getImage(ImageResource.IMG_INTERNAL_BROWSER);
54 .getImage(ImageResource.IMG_EXTERNAL_BROWSER);
60 * Returns the label text for the given column of the given element.
63 * the object representing the entire row, or <code>null</code>
64 * indicating that no input object is set in the viewer
66 * the zero-based index of the column in which the label appears
68 public String getColumnText(Object element, int columnIndex) {
69 IWebBrowser browser = (IWebBrowser) element;
70 if (browser instanceof IExternalWebBrowser) {
72 return notNull(((IExternalWebBrowser) browser).getName());
73 else if (columnIndex == 1)
74 return notNull(((IExternalWebBrowser) browser).getLocation());
75 else if (columnIndex == 2)
76 return notNull(((IExternalWebBrowser) browser).getParameters());
77 } else if (browser instanceof IInternalWebBrowser) {
79 return notNull(((IInternalWebBrowser) browser).getName());
84 protected String notNull(String s) {
94 public boolean isLabelProperty(Object element, String property) {
101 public void removeListener(ILabelProviderListener listener) {