First commit in a looooooong time. I had connectivity problems.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / actions / RunTestsAction.java
1 /*
2  * Created on Jun 10, 2004
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */
7 package net.sourceforge.phpeclipse.phpunit.actions;
8
9 import java.io.IOException;
10
11 import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
12
13 import org.eclipse.core.resources.IFile;
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.swt.widgets.Item;
17 import org.eclipse.ui.IObjectActionDelegate;
18 import org.eclipse.ui.IWorkbenchPart;
19 import org.eclipse.ui.views.navigator.ResourceNavigator;
20
21 /**
22  * @author Ali Echihabi
23  *
24  * To change the template for this generated type comment go to
25  * Window>Preferences>Java>Code Generation>Code and Comments
26  */
27 public class RunTestsAction implements IObjectActionDelegate {
28
29
30         
31
32         /* (non-Javadoc)
33          * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
34          */
35         public void setActivePart(IAction action, IWorkbenchPart targetPart) {
36                 // TODO Auto-generated method stub
37                 
38                 System.out.println(targetPart.getTitle());
39                 ResourceNavigator nav = (ResourceNavigator)targetPart;
40                 
41                 Item selectedItem = nav.getViewer().getTree().getSelection()[0];
42                 
43                 Object d = selectedItem.getData();
44 //              
45 //              try {
46 //                      
47 //                      IFile data = (IFile) selectedItem.getData();
48 //                      
49 //              }
50 //              catch(Exception e) {
51 //                      
52 //                      e.printStackTrace();
53 //                      
54 //              }
55 //              
56                 
57                 
58                 
59 //              Shell shell =  PHPUnitPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
60 //              
61 //              if(shell instanceof IStructuredSelection) {
62 //                      
63 //                      Object testObj = ((IStructuredSelection) )
64 //              } 
65 //              
66                 
67                 
68                 
69         }
70
71         /* (non-Javadoc)
72          * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
73          */
74         public void run(IAction action) {
75                 
76                 try {
77                         PHPUnitView.getDefault().startTests();
78                 } catch (IOException e) {
79                         // TODO Auto-generated catch block
80                         e.printStackTrace();
81                 }
82                 
83                 
84         }
85
86         /* (non-Javadoc)
87          * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
88          */
89         public void selectionChanged(IAction action, ISelection selection) {
90                 // TODO Auto-generated method stub
91                 
92         }
93
94 }