1 package com
.intellij
.execution
.testframework
.sm
.runner
.ui
.statistics
;
3 import com
.intellij
.execution
.testframework
.AbstractTestProxy
;
4 import com
.intellij
.execution
.testframework
.sm
.runner
.ui
.SMTRunnerTestTreeView
;
5 import com
.intellij
.execution
.testframework
.sm
.runner
.ui
.TestResultsViewer
;
6 import com
.intellij
.openapi
.actionSystem
.AnAction
;
7 import com
.intellij
.openapi
.actionSystem
.AnActionEvent
;
8 import com
.intellij
.openapi
.actionSystem
.Presentation
;
9 import org
.jetbrains
.annotations
.Nullable
;
12 * @author Roman Chernyatchik
14 public class ShowStatisticsAction
extends AnAction
{
16 public void actionPerformed(final AnActionEvent e
) {
17 final SMTRunnerTestTreeView sender
= e
.getData(SMTRunnerTestTreeView
.SM_TEST_RUNNER_VIEW
);
22 final TestResultsViewer resultsViewer
= sender
.getResultsViewer();
23 assert resultsViewer
!= null;
25 resultsViewer
.showStatisticsForSelectedProxy();
29 public void update(final AnActionEvent e
) {
30 final Presentation presentation
= getTemplatePresentation();
32 // visible onle in SMTRunnerTestTreeView
33 presentation
.setVisible(e
.getData(SMTRunnerTestTreeView
.SM_TEST_RUNNER_VIEW
) != null);
34 // enabled if some proxy is selected
35 presentation
.setEnabled(getSelectedTestProxy(e
) != null);
39 private Object
getSelectedTestProxy(final AnActionEvent e
) {
40 return e
.getDataContext().getData (AbstractTestProxy
.DATA_CONSTANT
);