mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
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>
This commit is contained in:
parent
cfbb774b7a
commit
a7717b2973
1 changed files with 28 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue