corrected the number of tests expected in progress view. Added toolbar actions to...
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / actions / RunTestsAction.java
index bfb6799..2e1c39c 100644 (file)
@@ -6,10 +6,17 @@
  */
 package net.sourceforge.phpeclipse.phpunit.actions;
 
+import java.io.IOException;
+
+import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
+
+import org.eclipse.core.resources.IFile;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Item;
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.navigator.ResourceNavigator;
 
 /**
  * @author Ali Echihabi
@@ -19,19 +26,60 @@ import org.eclipse.ui.IWorkbenchPart;
  */
 public class RunTestsAction implements IObjectActionDelegate {
 
+
+       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
         */
        public void setActivePart(IAction action, IWorkbenchPart targetPart) {
                // TODO Auto-generated method stub
                
+               System.out.println(targetPart.getTitle());
+               ResourceNavigator nav = (ResourceNavigator)targetPart;
+               
+               Item selectedItem = nav.getViewer().getTree().getSelection()[0];
+               
+               Object d = selectedItem.getData();
+//             
+//             try {
+//                     
+//                     IFile data = (IFile) selectedItem.getData();
+//                     
+//             }
+//             catch(Exception e) {
+//                     
+//                     e.printStackTrace();
+//                     
+//             }
+//             
+               
+               
+               
+//             Shell shell =  PHPUnitPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+//             
+//             if(shell instanceof IStructuredSelection) {
+//                     
+//                     Object testObj = ((IStructuredSelection) )
+//             } 
+//             
+               
+               
+               
        }
 
        /* (non-Javadoc)
         * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
         */
        public void run(IAction action) {
-               // TODO Auto-generated method stub
+               
+               try {
+                       PHPUnitView.getDefault().startTests();
+               } catch (IOException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }
+               
                
        }