*/
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
*/
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();
+ }
+
}