Bug 25324 Ability to know when tests are finished [junit]
Hi, I'm writing a Cactus Plugin that extends the JUnit Plugin and I need to know when the tests have finished running in the TestRunner. There is a nice ITestRunListener interface for that. My idea was thus to implement this interface and somehow register my listener to the TestRunner (RemoteTestRunnerClient). However: 1/ Currently the RemoteTestRunnerClient implementation only supports one listener 2/ There is no API in TestRunnerViewPart to get access to the TestRunner I am attaching a patch that should provide this facility. However, I need your help to know if this is the right approach or not. Thank you -Vincent
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JUnitPlugin.java
}
	/*
	 * @see ILaunchListener#launchChanged(ILaunch)
	 */
	public void launchChanged(final ILaunch launch) {
		if (!fTrackedLaunches.contains(launch))
			return;
			
		ILaunchConfiguration config= launch.getLaunchConfiguration();
		IType launchedType= null;
		int port= -1;
		if (config != null) {
			
			String portStr= launch.getAttribute(JUnitBaseLaunchConfiguration.PORT_ATTR);
			String typeStr= launch.getAttribute(JUnitBaseLaunchConfiguration.TESTTYPE_ATTR);
			if (portStr != null && typeStr != null) {
				port= Integer.parseInt(portStr);
				IJavaElement element= JavaCore.create(typeStr);
				if (element instanceof IType) 
					launchedType= (IType)element; 
			}
		}	
		if (launchedType != null) {
			fTrackedLaunches.remove(launch);
			final int finalPort= port;
			final IType finalType= launchedType;
			getDisplay().asyncExec(new Runnable() {
				public void run() {
					connectTestRunner(launch, finalType, finalPort);
				}