diff --git a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java --- a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java +++ b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/ResultWindow.java @@ -65,6 +65,9 @@ import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; import org.openide.awt.MouseUtils; import org.openide.awt.TabbedPaneFactory; import org.openide.util.Exceptions; @@ -95,7 +98,7 @@ private Map viewMap = new HashMap(); private Map ioMap = new HashMap(); - private final JTabbedPane tabPane; + private static JTabbedPane tabPane; private JPopupMenu pop; private PopupListener popL; private CloseListener closeL; @@ -343,7 +346,7 @@ activated = false; } - private JSplitPane getCurrentResultView(){ + private static JSplitPane getCurrentResultView(){ return (JSplitPane)tabPane.getSelectedComponent(); } @@ -468,6 +471,48 @@ } } + @ActionID( + category = "CommonTestRunner", + id = "org.netbeans.modules.gsf.testrunner.api.ResultWindow.Rerun") + @ActionRegistration( + displayName = "#CTL_Rerun") + @ActionReference(path = "Shortcuts", name = "D-J") + @NbBundle.Messages("CTL_Rerun=Rerun Action private") + public static final class Rerun extends AbstractAction { + @Override + public void actionPerformed(ActionEvent e) { + StatisticsPanel statisticsPanel = getStatisticsPanel(); + if(statisticsPanel != null) { + statisticsPanel.rerun(false); + } + } + } + + @ActionID( + category = "CommonTestRunner", + id = "org.netbeans.modules.gsf.testrunner.api.ResultWindow.RerunFailed") + @ActionRegistration( + displayName = "#CTL_RerunFailed") + @ActionReference(path = "Shortcuts", name = "D-F10") + @NbBundle.Messages("CTL_RerunFailed=Rerun Failed Action private") + public static final class RerunFailed extends AbstractAction { + @Override + public void actionPerformed(ActionEvent e) { + StatisticsPanel statisticsPanel = getStatisticsPanel(); + if(statisticsPanel != null) { + statisticsPanel.rerun(true); + } + } + } + + private static StatisticsPanel getStatisticsPanel() { + JSplitPane view = getCurrentResultView(); + if (view == null || !(view.getLeftComponent() instanceof StatisticsPanel)) { + return null; + } + return (StatisticsPanel) view.getLeftComponent(); + } + private class Close extends AbstractAction { public Close() { super(NbBundle.getMessage(ResultWindow.class, "LBL_CloseWindow")); //NOI18N diff --git a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/StatisticsPanel.java b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/StatisticsPanel.java --- a/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/StatisticsPanel.java +++ b/gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/api/StatisticsPanel.java @@ -303,6 +303,17 @@ treePanel.selectPreviousFailure(); } + void rerun(boolean failed) { + final RerunHandler rerunHandler = displayHandler.getSession().getRerunHandler(); + if (rerunHandler != null) { + if (failed) { + rerunHandler.rerun(treePanel.getFailedTests()); + return; + } + rerunHandler.rerun(); + } + } + void selectNextFailure() { treePanel.selectNextFailure(); }