/* * Created on Aug 8, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package net.sourceforge.phpeclipse.phpunit; import net.sourceforge.phpeclipse.phpunit.testpool.TestCase; import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.graphics.Image; /** * @author Ali Echihabi * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class TestPoolLabelProvider extends LabelProvider { public String getText(Object element) { String text = ""; if(element instanceof TestSuite) return ((TestSuite)element).getName(); else if(element instanceof TestCase) { text = ((TestCase)element).getTestName(); //has the form: TESTSUITENAME_TESTNAME } else text = "UNKNOWN ELEMENT TYPE"; return text; } public Image getImage(Object element) { Image image = null; ImageDescriptor descriptor = null; if(element instanceof TestSuite) { TestSuite suite = (TestSuite)element; descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS; if(suite.hasError()) descriptor = PHPUnitImages.DESC_TEST_SUITE_ERROR; else if(suite.hasFailure()) descriptor = PHPUnitImages.DESC_TEST_SUITE_FAILURE; else if(suite.isAllPass()) descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS; } else if(element instanceof TestCase) { TestCase test = (TestCase)element; descriptor = PHPUnitImages.DESC_TEST_PASS; if(test.isError()) descriptor = PHPUnitImages.DESC_TEST_ERROR; else if(test.isFailure()) descriptor = PHPUnitImages.DESC_TEST_FAILURE; else if(test.isPass()) descriptor = PHPUnitImages.DESC_TEST_PASS; } image = descriptor.createImage(); return image; } }