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

Fix NPE if Launch Dialog not open yet (#561)

Some flows (such as open JUnit test case) does a IRunnableContext.run
before the UI is open. Therefore we need to fall back on the platform
progress service to run it since the launch config UI is not ready yet

Fixes #555
This commit is contained in:
Jonah Graham 2023-09-15 17:26:15 -04:00 committed by GitHub
parent 8062151c30
commit 5a4320d9e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.launchbar.ui;singleton:=true
Bundle-Version: 2.5.100.qualifier
Bundle-Version: 2.5.200.qualifier
Bundle-Activator: org.eclipse.launchbar.ui.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,

View file

@ -49,6 +49,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILaunchBarLaunchConfigDialog {
@ -325,6 +326,10 @@ public class LaunchBarLaunchConfigDialog extends TitleAreaDialog implements ILau
@Override
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
throws InvocationTargetException, InterruptedException {
if (getShell() == null || !getShell().isVisible()) {
PlatformUI.getWorkbench().getProgressService().run(fork, cancelable, runnable);
return;
}
Control lastControl = getShell().getDisplay().getFocusControl();
if (lastControl != null && lastControl.getShell() != getShell()) {
lastControl = null;