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 org.eclipse.webbrowser.internal;
13 import org.eclipse.jface.viewers.ILabelProviderListener;
15 import org.eclipse.swt.graphics.Image;
16 import org.eclipse.webbrowser.IExternalWebBrowser;
17 import org.eclipse.webbrowser.IInternalWebBrowser;
18 import org.eclipse.webbrowser.IWebBrowser;
19 import org.eclipse.jface.viewers.ITableLabelProvider;
21 * Web browser table label provider.
23 public class BrowserTableLabelProvider implements ITableLabelProvider {
25 * BrowserTableLabelProvider constructor comment.
27 public BrowserTableLabelProvider() {
34 public void addListener(ILabelProviderListener listener) { }
39 public void dispose() { }
44 public Image getColumnImage(Object element, int columnIndex) {
45 if (columnIndex == 0) {
46 if (element instanceof IInternalWebBrowser)
47 return ImageResource.getImage(ImageResource.IMG_INTERNAL_BROWSER);
49 return ImageResource.getImage(ImageResource.IMG_EXTERNAL_BROWSER);
55 * Returns the label text for the given column of the given element.
57 * @param element the object representing the entire row, or
58 * <code>null</code> indicating that no input object is set
60 * @param columnIndex the zero-based index of the column in which the label appears
62 public String getColumnText(Object element, int columnIndex) {
63 IWebBrowser browser = (IWebBrowser)element;
64 if (browser instanceof IExternalWebBrowser) {
66 return notNull(((IExternalWebBrowser)browser).getName());
67 else if (columnIndex == 1)
68 return notNull(((IExternalWebBrowser)browser).getLocation());
69 else if (columnIndex == 2)
70 return notNull(((IExternalWebBrowser)browser).getParameters());
71 } else if(browser instanceof IInternalWebBrowser) {
73 return notNull(((IInternalWebBrowser)browser).getName());
78 protected String notNull(String s) {
88 public boolean isLabelProperty(Object element, String property) {
95 public void removeListener(ILabelProviderListener listener) { }