Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Ward2016-08-23 12:07:30 +0000
committerAdam Ward2016-08-23 17:38:54 +0000
commita7717b297312195c397ddfcc427d55647c43847b (patch)
treec88d832c9c6224b0af21f8b91870db09a570cb5e /testsrunner/org.eclipse.cdt.testsrunner
parentcfbb774b7a86f0cfb3711b0feae3d47091b16c6f (diff)
downloadorg.eclipse.cdt-a7717b297312195c397ddfcc427d55647c43847b.tar.gz
org.eclipse.cdt-a7717b297312195c397ddfcc427d55647c43847b.tar.xz
org.eclipse.cdt-a7717b297312195c397ddfcc427d55647c43847b.zip
Bug 500120 - Fix C/C++ Unit test view history dropdown NPE
Changes: - Listen for launch configurations to be deleted. Remove any testing sessions that ran using the deleted launch configuration. Testing: - Ran a couple test projects using the Google Test Runner. Ensured all sessions showed up in the dropdown. Deleted the launch configuration and tried to dropped down the list again. Deleted launch configuration sessions were removed from the list and no NPE. - Did the same above test but deleted the project, instead of launch configuration, which causes the launch configuration to get deleted and the same successful results occurred Change-Id: Ia32f3a6282ed0da7e154e7a7138681c7be16c0ef Signed-off-by: Adam Ward <award@blackberry.com>
Diffstat (limited to 'testsrunner/org.eclipse.cdt.testsrunner')
-rw-r--r--testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/model/TestingSessionsManager.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/model/TestingSessionsManager.java b/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/model/TestingSessionsManager.java
index d00045bb7bc..43c7f6e4787 100644
--- a/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/model/TestingSessionsManager.java
+++ b/testsrunner/org.eclipse.cdt.testsrunner/src/org/eclipse/cdt/testsrunner/internal/model/TestingSessionsManager.java
@@ -11,20 +11,23 @@
package org.eclipse.cdt.testsrunner.internal.model;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.cdt.testsrunner.internal.launcher.TestsRunnerProvidersManager;
import org.eclipse.cdt.testsrunner.internal.launcher.TestsRunnerProviderInfo;
+import org.eclipse.cdt.testsrunner.internal.launcher.TestsRunnerProvidersManager;
import org.eclipse.cdt.testsrunner.model.ITestingSession;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
/**
* Manages all the testing sessions (creates, activates, stores history).
*/
-public class TestingSessionsManager {
+public class TestingSessionsManager implements ILaunchConfigurationListener {
/** Tests Runners Plug-ins Manager. */
private TestsRunnerProvidersManager testsRunnersManager;
@@ -43,6 +46,7 @@ public class TestingSessionsManager {
public TestingSessionsManager(TestsRunnerProvidersManager testsRunnersManager) {
this.testsRunnersManager = testsRunnersManager;
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this);
}
/**
@@ -212,4 +216,26 @@ public class TestingSessionsManager {
}
}
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ // Ignore
+ }
+
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ // Ignore
+ }
+
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ for (Iterator<TestingSession> iterator = sessions.iterator(); iterator.hasNext();) {
+ TestingSession session = iterator.next();
+ if (session.getLaunch().getLaunchConfiguration()
+ .equals(configuration)) {
+ iterator.remove();
+ }
+ }
+ truncateHistory();
+ }
+
}

Back to the top