-/*
- * Created on Aug 8, 2004
+/*************************************************************************
+ * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
*
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
+ * Plugin for PHP unit Testing.
+ * www.phpeclipse.de
+ *
+ *************************************************************************/
+
package net.sourceforge.phpeclipse.phpunit;
import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
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
+
+ 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 (element instanceof TestSuite) {
+
+ TestSuite suite = (TestSuite) element;
+ descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
- if(suite.hasError())
+ if (suite.hasError())
descriptor = PHPUnitImages.DESC_TEST_SUITE_ERROR;
- else if(suite.hasFailure())
+ else if (suite.hasFailure())
descriptor = PHPUnitImages.DESC_TEST_SUITE_FAILURE;
- else if(suite.isAllPass())
+ else if (suite.isAllPass())
descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
-
-
- } else if(element instanceof TestCase) {
-
- TestCase test = (TestCase)element;
-
+
+ } else if (element instanceof TestCase) {
+
+ TestCase test = (TestCase) element;
+
descriptor = PHPUnitImages.DESC_TEST_PASS;
-
- if(test.isError())
+
+ if (test.isError())
descriptor = PHPUnitImages.DESC_TEST_ERROR;
- else if(test.isFailure())
+ else if (test.isFailure())
descriptor = PHPUnitImages.DESC_TEST_FAILURE;
- else if(test.isPass())
+ else if (test.isPass())
descriptor = PHPUnitImages.DESC_TEST_PASS;
-
+
}
-
+
image = descriptor.createImage();
-
-
+
return image;
-
+
}
}