1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Explicitly activate shell for launchbar selector

In https://github.com/eclipse-platform/eclipse.platform.swt/issues/450
the behaviour was changed so that setFocus no longer activates the shell
by default. Therefore when creating the popup shell and setting the focus
the overall focus was still on a control in the main eclipse shell.

This affected Eclipse SWT/Platform 4.29 M1 and has been changed for
M3. However there is intention to (possibly) change the default back
to not activating in setFocus. If that happens this patch will be ready
for it, and in the meantime (until CDT changes to M3) it resolves this
test failure:

`createNewLaunchConfig (org.eclipse.launchbar.ui.tests.internal.CreateLaunchConfigTests) with error`

full trace:

```java
org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find shell matching: with text 'Create Launch Configuration'
	at org.eclipse.launchbar.ui.tests.internal.CreateLaunchConfigTests.createNewLaunchConfig(CreateLaunchConfigTests.java:77)
Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 10000 ms.: Could not find shell matching: with text 'Create Launch Configuration'
	at org.eclipse.launchbar.ui.tests.internal.CreateLaunchConfigTests.createNewLaunchConfig(CreateLaunchConfigTests.java:77)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
```
This commit is contained in:
Jonah Graham 2023-08-10 10:41:39 -04:00
parent de012f42a6
commit 1e04efa017

View file

@ -313,6 +313,7 @@ public abstract class CSelector extends Composite {
popup.setLocation(popupLocation.x, popupLocation.y + 5);
restoreShellSize();
popup.setVisible(true);
popup.setActive();
popup.setFocus();
getDisplay().addFilter(SWT.FocusIn, focusOutListener);
getDisplay().addFilter(SWT.FocusOut, focusOutListener);