First commit in a looooooong time. I had connectivity problems.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / ResultsInfoComposite.java
index 8f50171..627da42 100644 (file)
@@ -6,10 +6,13 @@
  */
 package net.sourceforge.phpeclipse.phpunit;
 
+import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
+
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
 
 /**
  * @author Ali Echihabi
@@ -20,7 +23,8 @@ import org.eclipse.swt.widgets.Text;
 public class ResultsInfoComposite extends Composite {
 
 
-       private Text reportArea; // TODO: replace with Tree display like JUnit
+       
+       private TreeViewer treeViewer;
        
        /**
         * @param arg0
@@ -28,32 +32,38 @@ public class ResultsInfoComposite extends Composite {
         */
        public ResultsInfoComposite(Composite parent) {
 
-               super(parent, SWT.NONE);
+               super(parent, SWT.BORDER);
 
-               setLayout(new FillLayout(SWT.VERTICAL));
+               GridLayout layout = new GridLayout();
+               layout.numColumns = 1;
+               
+               setLayout(layout);
+               
+               treeViewer = new TreeViewer(this, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
 
-               reportArea =
-                       new Text(
-                               this,
-                               SWT.MULTI
-                                       | SWT.BORDER
-                                       | SWT.WRAP
-                                       | SWT.V_SCROLL
-                                       | SWT.READ_ONLY);
+               treeViewer.getControl().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
                
+               
+               TestPoolLabelProvider labelProvider = new TestPoolLabelProvider();
+               TestPoolContentProvider contentProvider= new TestPoolContentProvider();
+               
+               treeViewer.setContentProvider(contentProvider);
+               treeViewer.setLabelProvider(labelProvider);
+                               
        }
 
        
+       public void resetInfo() {
+               
+               treeViewer.setInput(null);
+       }
        
        public void updateInfo(TestPool testPool) {
                
                // take care of the TreeView and its content and label providers.
+       
+               treeViewer.setInput(testPool.getRoot());
                
        }
-       
-
-
-
-       
 
 }