From 62545585be60b38bc087faf6767a0214b32714b7 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Fri, 3 Jun 2016 16:30:26 -0400 Subject: [PATCH] Make sure we can terminate a launch before we do it. DSF throws an exception when we try to terminate a launch that's already terminated. Change-Id: Ie836e1f3e182b009ba4649a27afda716e8876885 --- .../commands/StopActiveCommandHandler.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/commands/StopActiveCommandHandler.java b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/commands/StopActiveCommandHandler.java index 06276c71420..ab345d37f40 100644 --- a/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/commands/StopActiveCommandHandler.java +++ b/bundles/org.eclipse.launchbar.ui/src/org/eclipse/launchbar/ui/internal/commands/StopActiveCommandHandler.java @@ -53,19 +53,21 @@ public class StopActiveCommandHandler extends AbstractHandler { return Status.OK_STATUS; } for (ILaunch launch : activeLaunches) { - ILaunchConfiguration launchConfig = launch.getLaunchConfiguration(); - if (activeConfig.equals(launchConfig)) { - launch.terminate(); - continue; - } - if (launchConfig instanceof ILaunchConfigurationWorkingCopy) { - // There are evil delegates that use a working - // copy for scratch storage - if (activeConfig - .equals(((ILaunchConfigurationWorkingCopy) launchConfig).getOriginal())) { + if (launch.canTerminate()) { + ILaunchConfiguration launchConfig = launch.getLaunchConfiguration(); + if (activeConfig.equals(launchConfig)) { launch.terminate(); continue; } + if (launchConfig instanceof ILaunchConfigurationWorkingCopy) { + // There are evil delegates that use a + // working copy for scratch storage + if (activeConfig + .equals(((ILaunchConfigurationWorkingCopy) launchConfig).getOriginal())) { + launch.terminate(); + continue; + } + } } } return Status.OK_STATUS;