2 * Created on Aug 8, 2004
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
7 package net.sourceforge.phpeclipse.phpunit;
9 import java.net.MalformedURLException;
12 import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
13 import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
15 import org.eclipse.jface.resource.ImageDescriptor;
16 import org.eclipse.jface.viewers.LabelProvider;
17 import org.eclipse.swt.graphics.Image;
20 * @author Ali Echihabi
22 * To change the template for this generated type comment go to
23 * Window>Preferences>Java>Code Generation>Code and Comments
25 public class TestPoolLabelProvider extends LabelProvider {
27 //TODO: replace with installDir + path
28 private static String iconsPath = "C:\\Documents and Settings\\Ali Echihabi\\My Documents\\workspace.eclipse2.1\\net.sourceforge.phpeclipse.phpunit\\icons";
30 public String getText(Object element) {
32 if(element instanceof TestSuite)
33 return ((TestSuite)element).getName();
34 else if(element instanceof TestCase)
35 return ((TestCase)element).getTestName();
37 return "UNKNOWN ELEMENT TYPE";
43 public Image getImage(Object element) {
50 if(element instanceof TestSuite) {
52 TestSuite suite = (TestSuite)element;
54 //TODO check if there has been an error, a failure...
58 } else if(element instanceof TestCase) {
60 TestCase test = (TestCase)element;
64 else if(test.isFailure())
65 icon = "testfail.gif";
66 else if(test.isPass())
72 ImageDescriptor descriptor = ImageDescriptor.createFromURL(new URL("file://" + iconsPath + "//" + icon));
73 image = descriptor.createImage();
75 } catch (MalformedURLException e) {
78 image = ImageDescriptor.getMissingImageDescriptor().createImage();