2 * Created on Jun 10, 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.actions;
9 import java.io.IOException;
11 import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
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;
22 * @author Ali Echihabi
24 * To change the template for this generated type comment go to
25 * Window>Preferences>Java>Code Generation>Code and Comments
27 public class RunTestsAction implements IObjectActionDelegate {
33 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
35 public void setActivePart(IAction action, IWorkbenchPart targetPart) {
36 // TODO Auto-generated method stub
38 System.out.println(targetPart.getTitle());
39 ResourceNavigator nav = (ResourceNavigator)targetPart;
41 Item selectedItem = nav.getViewer().getTree().getSelection()[0];
43 Object d = selectedItem.getData();
47 // IFile data = (IFile) selectedItem.getData();
50 // catch(Exception e) {
52 // e.printStackTrace();
59 // Shell shell = PHPUnitPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
61 // if(shell instanceof IStructuredSelection) {
63 // Object testObj = ((IStructuredSelection) )
72 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
74 public void run(IAction action) {
77 PHPUnitView.getDefault().startTests();
78 } catch (IOException e) {
79 // TODO Auto-generated catch block
87 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
89 public void selectionChanged(IAction action, ISelection selection) {
90 // TODO Auto-generated method stub