Bug #1248155: avoid NPE in parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / wizards / html / TableElementLabelProvider.java
1 /*
2  * $Id: TableElementLabelProvider.java,v 1.2 2005-05-06 00:57:33 stefanbjarni Exp $
3  * Copyright Narushima Hironori. All rights reserved.
4  */
5 package net.sourceforge.phpeclipse.wizards.html;
6
7 import org.eclipse.jface.viewers.ILabelProviderListener;
8 import org.eclipse.jface.viewers.ITableLabelProvider;
9 import org.eclipse.swt.graphics.Image;
10 import org.w3c.dom.Element;
11
12 /**
13  * 
14  */
15 public class TableElementLabelProvider implements ITableLabelProvider {
16
17         public Image getColumnImage(Object element, int columnIndex) {
18                 return null;
19         }
20
21         public String getColumnText(Object element, int columnIndex) {
22                 Element[] cells = TableElementModel.chooseCellElements((Element)element);
23                 if(columnIndex < cells.length){
24                         Element elem = cells[columnIndex];
25                         return elem.toString();
26                 }else{
27                         throw new IllegalArgumentException("Invalid element:" + element);
28                 }
29         }
30
31         public boolean isLabelProperty(Object element, String property) {
32                 return TableElementModel.toNumeric(property) != -1;
33         }
34
35         public void addListener(ILabelProviderListener listener) {
36         }
37
38         public void removeListener(ILabelProviderListener listener) {
39         }
40
41         public void dispose() {
42         }
43
44 }