Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / BrowserTableLabelProvider.java
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
7  �*
8  * Contributors:
9  *    IBM - Initial API and implementation
10  **********************************************************************/
11 package net.sourceforge.phpeclipse.webbrowser.internal;
12
13 import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowser;
14 import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowser;
15 import net.sourceforge.phpeclipse.webbrowser.IWebBrowser;
16
17 import org.eclipse.jface.viewers.ILabelProviderListener;
18 import org.eclipse.jface.viewers.ITableLabelProvider;
19 import org.eclipse.swt.graphics.Image;
20
21 /**
22  * Web browser table label provider.
23  */
24 public class BrowserTableLabelProvider implements ITableLabelProvider {
25         /**
26          * BrowserTableLabelProvider constructor comment.
27          */
28         public BrowserTableLabelProvider() {
29                 super();
30         }
31
32         /**
33          * 
34          */
35         public void addListener(ILabelProviderListener listener) {
36         }
37
38         /**
39          * 
40          */
41         public void dispose() {
42         }
43
44         /**
45          * 
46          */
47         public Image getColumnImage(Object element, int columnIndex) {
48                 if (columnIndex == 0) {
49                         if (element instanceof IInternalWebBrowser)
50                                 return ImageResource
51                                                 .getImage(ImageResource.IMG_INTERNAL_BROWSER);
52                         else
53                                 return ImageResource
54                                                 .getImage(ImageResource.IMG_EXTERNAL_BROWSER);
55                 }
56                 return null;
57         }
58
59         /**
60          * Returns the label text for the given column of the given element.
61          * 
62          * @param element
63          *            the object representing the entire row, or <code>null</code>
64          *            indicating that no input object is set in the viewer
65          * @param columnIndex
66          *            the zero-based index of the column in which the label appears
67          */
68         public String getColumnText(Object element, int columnIndex) {
69                 IWebBrowser browser = (IWebBrowser) element;
70                 if (browser instanceof IExternalWebBrowser) {
71                         if (columnIndex == 0)
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) {
78                         if (columnIndex == 0)
79                                 return notNull(((IInternalWebBrowser) browser).getName());
80                 }
81                 return "";
82         }
83
84         protected String notNull(String s) {
85                 if (s != null)
86                         return s;
87                 else
88                         return "";
89         }
90
91         /**
92          * 
93          */
94         public boolean isLabelProperty(Object element, String property) {
95                 return false;
96         }
97
98         /**
99          * 
100          */
101         public void removeListener(ILabelProviderListener listener) {
102         }
103 }