eclipse.platform icon indicating copy to clipboard operation
eclipse.platform copied to clipboard

The progress indicator of the LaunchConfigurationsDialog is not shown when calling "run" with "fork == false"

Open fedejeanne opened this issue 2 years ago • 0 comments

If I call org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.run(boolean, boolean, IRunnableWithProgress) and pass false as the first parameter (fork) then the progress indicator never shows up in the bottom area of the dialog.

This was discovered while working on PR #674 (eclipse-pde)

How to reproduce

A small hack to help reproduce the error

Change the method org.eclipse.jdt.internal.junit.util.TestSearchEngine.findTestMethods(IRunnableContext, IJavaProject, IType, TestKind):

  • Add some idle wait
  • Set the fork parameter at the end to false

In the end. it should look like this:

public static Set<String> findTestMethods(IRunnableContext context, final IJavaProject javaProject, IType type, TestKind testKind) throws InvocationTargetException, InterruptedException {
	final Set<String> result= new HashSet<>();
	
	IRunnableWithProgress runnable= progressMonitor -> {
		try {
			String message= Messages.format(JUnitMessages.TestSearchEngine_search_message_progress_monitor, type.getElementName());
			SubMonitor subMonitor= SubMonitor.convert(progressMonitor, message, 1 + 5);// add + 5
	
			// -----------------------------------------------
			// Add this idle wait
			// -----------------------------------------------
			for (int i= 0; i < 5; i++) {
				subMonitor.split(1);
				Thread.sleep(1000);
			}
			// -----------------------------------------------
	
			collectMethodNames(type, javaProject, testKind.getId(), result, subMonitor.split(1));
		} catch (CoreException e) {
			throw new InvocationTargetException(e);
		}
	};
	// -----------------------------------------------
	context.run(/*fork*/ false, true, runnable); // set "fork" to false --> no progress indicator at the bottom of the dialog
	// -----------------------------------------------
	
	return result;
}

## Test it
* Open the _Run Configurations Dialog_
* Create 2 valid JUnit configurations
* Switch between the configurations
   --> This indicator at the bottom should **NOT** appear, it should look like this:

![image](https://github.com/eclipse-platform/eclipse.platform/assets/2205684/d675829d-e2f7-49c2-82e2-8e17c4e235b5)

* Set the `fork` parameter back to `true`
* Test again
   --> The progress indicator should be visible, like this:
![image](https://github.com/eclipse-platform/eclipse.platform/assets/2205684/ed858671-de98-4919-861e-48783e6b6cc6)

fedejeanne avatar Oct 25 '23 14:10 fedejeanne