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 net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
10 import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
12 import org.eclipse.jface.resource.ImageDescriptor;
13 import org.eclipse.jface.viewers.LabelProvider;
14 import org.eclipse.swt.graphics.Image;
17 * @author Ali Echihabi
19 * To change the template for this generated type comment go to
20 * Window>Preferences>Java>Code Generation>Code and Comments
22 public class TestPoolLabelProvider extends LabelProvider {
24 public String getText(Object element) {
28 if(element instanceof TestSuite)
29 return ((TestSuite)element).getName();
30 else if(element instanceof TestCase) {
32 text = ((TestCase)element).getTestName();
34 //has the form: TESTSUITENAME_TESTNAME
38 text = "UNKNOWN ELEMENT TYPE";
44 public Image getImage(Object element) {
47 ImageDescriptor descriptor = null;
49 if(element instanceof TestSuite) {
51 TestSuite suite = (TestSuite)element;
52 descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
56 descriptor = PHPUnitImages.DESC_TEST_SUITE_ERROR;
57 else if(suite.hasFailure())
58 descriptor = PHPUnitImages.DESC_TEST_SUITE_FAILURE;
59 else if(suite.isAllPass())
60 descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
63 } else if(element instanceof TestCase) {
65 TestCase test = (TestCase)element;
67 descriptor = PHPUnitImages.DESC_TEST_PASS;
70 descriptor = PHPUnitImages.DESC_TEST_ERROR;
71 else if(test.isFailure())
72 descriptor = PHPUnitImages.DESC_TEST_FAILURE;
73 else if(test.isPass())
74 descriptor = PHPUnitImages.DESC_TEST_PASS;
78 image = descriptor.createImage();