From 1ba8a78112957fcab82b4b73ac22f103c2b51392 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 13 Oct 2010 14:09:56 +0400 Subject: [PATCH] stop tracking running test after user selects one --- .../junit2/ui/actions/RunningTestTracker.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java b/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java index 86b3826b3bdd..cd43452fa80c 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java @@ -33,6 +33,7 @@ class RunningTestTracker extends JUnitAdapter implements TestFrameworkPropertyLi private final JUnitRunningModel myModel; private TrackingPolicy myTrackingPolicy; private TestProxy myLastRan = null; + private TestProxy myLastSelected = null; private RunningTestTracker(final JUnitRunningModel model) { myModel = model; @@ -44,10 +45,22 @@ class RunningTestTracker extends JUnitAdapter implements TestFrameworkPropertyLi myTrackingPolicy.apply(); } + @Override + public void onTestSelected(TestProxy test) { + if (test != null && test.isLeaf()) { + myLastSelected = test; + } + } + public void onTestChanged(final TestEvent event) { if (event instanceof StateChangedEvent) { final TestProxy proxy = event.getSource(); - if (proxy == myLastRan && !isRunningState(proxy)) myLastRan = null; + if (proxy == myLastRan && !isRunningState(proxy)) { + if (myLastSelected == proxy){ + myLastSelected = null; + } + myLastRan = null; + } if (proxy.isLeaf() && isRunningState(proxy)) myLastRan = proxy; myTrackingPolicy.applyTo(proxy); } @@ -92,7 +105,7 @@ class RunningTestTracker extends JUnitAdapter implements TestFrameworkPropertyLi } private void selectLastTest() { - if (myLastRan != null && isRunningState(myLastRan)) + if (myLastRan != null && isRunningState(myLastRan) && myLastSelected == null) myModel.selectTest(myLastRan); } };