Rerun Failures action
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java
index 8265b80..5a26201 100755
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/internal/testing/ui/TestRunnerViewPart.java
@@ -28,7 +28,6 @@
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -120,7 +119,7 @@
public static final String NAME = "org.eclipse.dltk.testing.ResultView"; //$NON-NLS-1$
private static final String RERUN_LAST_COMMAND = "org.eclipse.dltk.testing.testingShortcut.rerunLast"; //$NON-NLS-1$
- //private static final String RERUN_FAILED_FIRST_COMMAND= "org.eclipse.dltk.testing.testingShortcut.rerunFailedFirst"; //$NON-NLS-1$
+ private static final String RERUN_FAILED_FIRST_COMMAND = "org.eclipse.dltk.testing.testingShortcut.rerunFailedFirst"; //$NON-NLS-1$
static final int REFRESH_INTERVAL = 200;
@@ -176,8 +175,8 @@
private Action fRerunLastTestAction;
private IHandlerActivation fRerunLastActivation;
- // private Action fRerunFailedFirstAction;
- // private IHandlerActivation fRerunFailedFirstActivation;
+ private Action fRerunFailedFirstAction;
+ private IHandlerActivation fRerunFailedFirstActivation;
private Action fFailuresOnlyFilterAction;
private ScrollLockAction fScrollLockAction;
@@ -805,20 +804,38 @@
}
}
- // private class RerunLastFailedFirstAction extends Action {
- // public RerunLastFailedFirstAction() {
- //setText(DLTKTestingMessages.TestRunnerViewPart_rerunfailuresaction_label);
- // setToolTipText(DLTKTestingMessages.
- // TestRunnerViewPart_rerunfailuresaction_tooltip);
- // DLTKTestingPlugin.setLocalImageDescriptors(this, "relaunchf.gif"); //$NON-NLS-1$
- // setEnabled(false);
- // setActionDefinitionId(RERUN_FAILED_FIRST_COMMAND);
- // }
- //
- // public void run(){
- // rerunTestFailedFirst();
- // }
- // }
+ private class RerunLastFailedFirstAction extends Action {
+ public RerunLastFailedFirstAction() {
+ setText(DLTKTestingMessages.TestRunnerViewPart_rerunfailuresaction_label);
+ setToolTipText(DLTKTestingMessages.TestRunnerViewPart_rerunfailuresaction_tooltip);
+ DLTKTestingPlugin.setLocalImageDescriptors(this, "relaunchf.gif"); //$NON-NLS-1$
+ setEnabled(false);
+ setActionDefinitionId(RERUN_FAILED_FIRST_COMMAND);
+ }
+
+ public void run() {
+ rerunTestFailedFirst();
+ }
+ }
+
+ private static class ActionHandlerWrapper extends AbstractHandler {
+
+ public ActionHandlerWrapper(Action action) {
+ this.action = action;
+ }
+
+ private final Action action;
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ action.run();
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return action.isEnabled();
+ }
+
+ }
private class ToggleOrientationAction extends Action {
private final int fActionOrientation;
@@ -1358,7 +1375,7 @@
stopUpdateJobs();
fStopAction.setEnabled(false);
- // fRerunFailedFirstAction.setEnabled(false);
+ fRerunFailedFirstAction.setEnabled(false);
fRerunLastTestAction.setEnabled(false);
} else {
@@ -1391,9 +1408,10 @@
}
private void updateRerunFailedFirstAction() {
- // boolean state= hasErrorsOrFailures() && fTestRunSession.getLaunch()
- // != null;
- // fRerunFailedFirstAction.setEnabled(state);
+ boolean state = hasErrorsOrFailures()
+ && fTestRunSession.getTestRunnerUI().canRerunFailures()
+ && fTestRunSession.getLaunch() != null;
+ fRerunFailedFirstAction.setEnabled(state);
}
private void setTitleToolTip() {
@@ -1418,7 +1436,7 @@
IHandlerService handlerService = (IHandlerService) getSite()
.getWorkbenchWindow().getService(IHandlerService.class);
handlerService.deactivateHandler(fRerunLastActivation);
- // handlerService.deactivateHandler(fRerunFailedFirstActivation);
+ handlerService.deactivateHandler(fRerunFailedFirstActivation);
setActiveTestRunSession(null);
if (fProgressImages != null)
@@ -1701,33 +1719,14 @@
fRerunLastTestAction = new RerunLastAction();
IHandlerService handlerService = (IHandlerService) getSite()
.getWorkbenchWindow().getService(IHandlerService.class);
- IHandler handler = new AbstractHandler() {
- public Object execute(ExecutionEvent event)
- throws ExecutionException {
- fRerunLastTestAction.run();
- return null;
- }
-
- public boolean isEnabled() {
- return fRerunLastTestAction.isEnabled();
- }
- };
fRerunLastActivation = handlerService.activateHandler(
- RERUN_LAST_COMMAND, handler);
+ RERUN_LAST_COMMAND, new ActionHandlerWrapper(
+ fRerunLastTestAction));
- // fRerunFailedFirstAction= new RerunLastFailedFirstAction();
- // handler = new AbstractHandler() {
- // public Object execute(ExecutionEvent event) throws ExecutionException
- // {
- // fRerunFailedFirstAction.run();
- // return null;
- // }
- // public boolean isEnabled() {
- // return fRerunFailedFirstAction.isEnabled();
- // }
- // };
- // fRerunFailedFirstActivation=
- // handlerService.activateHandler(RERUN_FAILED_FIRST_COMMAND, handler);
+ fRerunFailedFirstAction = new RerunLastFailedFirstAction();
+ fRerunFailedFirstActivation = handlerService.activateHandler(
+ RERUN_FAILED_FIRST_COMMAND, new ActionHandlerWrapper(
+ fRerunFailedFirstAction));
fFailuresOnlyFilterAction = new FailuresOnlyFilterAction();
@@ -1747,7 +1746,7 @@
toolBar.add(fScrollLockAction);
toolBar.add(new Separator());
toolBar.add(fRerunLastTestAction);
- // toolBar.add(fRerunFailedFirstAction);
+ toolBar.add(fRerunFailedFirstAction);
toolBar.add(fStopAction);
toolBar.add(fViewHistory.createHistoryDropDownAction());
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
index 60fc666..2ad8375 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/AbstractTestRunnerUI.java
@@ -94,6 +94,13 @@
}
/*
+ * @see org.eclipse.dltk.testing.ITestRunnerUI#canRerunFailedTests()
+ */
+ public boolean canRerunFailures() {
+ return false;
+ }
+
+ /*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
index cf2b233..f006cdd 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/ITestRunnerUI.java
@@ -113,4 +113,8 @@
*/
IScriptProject getProject();
+ /**
+ * Tests that this testing engine can return failed tests.
+ */
+ boolean canRerunFailures();
}
diff --git a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestingMessages.properties b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestingMessages.properties
index ea26238..4f51926 100644
--- a/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestingMessages.properties
+++ b/core/plugins/org.eclipse.dltk.testing/src/org/eclipse/dltk/testing/TestingMessages.properties
@@ -80,8 +80,8 @@
TestRunnerViewPart_rerunaction_label=Rerun Test
TestRunnerViewPart_rerunaction_tooltip=Rerun Test
TestRunnerViewPart_hierarchical_layout=Show Tests in &Hierarchy
-TestRunnerViewPart_rerunfailuresaction_label=Rerun Test - Failures First
-TestRunnerViewPart_rerunfailuresaction_tooltip=Rerun Test - Failures First
+TestRunnerViewPart_rerunfailuresaction_label=Rerun Failures
+TestRunnerViewPart_rerunfailuresaction_tooltip=Rerun Failures
TestRunnerViewPart_rerunFailedFirstLaunchConfigName={0} (Failed Tests first)
TestRunnerViewPart_ImportTestRunSessionAction_name=&Import...
TestRunnerViewPart_ImportTestRunSessionAction_title=Import Test Run