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) {
 
  34                 if(element instanceof TestSuite) 
 
  35                         return ((TestSuite)element).getName();
 
  36                 else if(element instanceof TestCase) {
 
  38                         text = ((TestCase)element).getTestName();
 
  40                         //has the form: TESTSUITENAME_TESTNAME
 
  44                         text = "UNKNOWN ELEMENT TYPE";
 
  50         public Image getImage(Object element) {
 
  57                         if(element instanceof TestSuite) {
 
  59                                 TestSuite suite = (TestSuite)element;
 
  61                                 //TODO check if there has been an error, a failure...
 
  65                         } else if(element instanceof TestCase) {
 
  67                                 TestCase test = (TestCase)element;
 
  71                                 else if(test.isFailure())
 
  72                                         icon = "testfail.gif";
 
  73                                 else if(test.isPass())
 
  79                         ImageDescriptor descriptor = ImageDescriptor.createFromURL(new URL("file://" + iconsPath + "//" + icon));
 
  80                         image = descriptor.createImage();
 
  82                 } catch (MalformedURLException e) {
 
  85                         image = ImageDescriptor.getMissingImageDescriptor().createImage();