Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Kubitz2021-11-15 09:54:45 +0000
committerMickael Istria2021-11-15 10:52:48 +0000
commita7533bd84d2276ba3180174559cb3a25d3430db8 (patch)
tree7e021c9ebc4f12a52eb2d7570c203223a0ba1c81
parentb703e4db3c9ed4e049a713c182b2d9417eb58e6e (diff)
downloadeclipse.platform.debug-a7533bd84d2276ba3180174559cb3a25d3430db8.tar.gz
eclipse.platform.debug-a7533bd84d2276ba3180174559cb3a25d3430db8.tar.xz
eclipse.platform.debug-a7533bd84d2276ba3180174559cb3a25d3430db8.zip
did only terminate a single random process of each kind. Change-Id: I150713ae6f7d1a7203155a96d914aaf6d2696919 Signed-off-by: Joerg Kubitz <jkubitz-eclipse@gmx.de> Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.debug/+/187731 Reviewed-by: Markus Duft <markus.duft@ssi-schaefer.com> Reviewed-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java25
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java2
2 files changed, 19 insertions, 8 deletions
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java
index de8ebd447..5c02a2523 100644
--- a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.ui.launchview.internal.impl;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import org.eclipse.core.runtime.CoreException;
@@ -74,11 +76,7 @@ public class DebugCoreLaunchObject implements ILaunchObject, Comparable<ILaunchO
@Override
public boolean canTerminate() {
- ILaunch launch = findLaunch(config.getName());
- if (launch != null && launch.canTerminate()) {
- return true;
- }
- return false;
+ return !findTerminateableLaunches(config.getName()).isEmpty();
}
@Override
@@ -87,8 +85,8 @@ public class DebugCoreLaunchObject implements ILaunchObject, Comparable<ILaunchO
// the processes takes longer than a few seconds.
// Instead we start a job that tries to terminate processes. If the job
// itself is stopped, we give up like Eclipse does.
- ILaunch launch = findLaunch(config.getName());
- if (launch != null && launch.canTerminate()) {
+ Collection<ILaunch> launches = findTerminateableLaunches(config.getName());
+ for (ILaunch launch: launches) {
Job terminateJob = new Job(NLS.bind(LaunchViewMessages.DebugCoreLaunchObject_Terminate, config.getName())) {
@Override
@@ -135,6 +133,19 @@ public class DebugCoreLaunchObject implements ILaunchObject, Comparable<ILaunchO
return null;
}
+ private static Collection<ILaunch> findTerminateableLaunches(String name) {
+ Collection<ILaunch> result = new ArrayList<>();
+ for (ILaunch l : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
+ if (l.getLaunchConfiguration() == null || l.isTerminated()) {
+ continue;
+ }
+ if (l.getLaunchConfiguration().getName().equals(name) && l.canTerminate()) {
+ result.add(l);
+ }
+ }
+ return result;
+ }
+
@Override
public void edit() {
// This prefers "debug" mode as the Eclipse infrastructure
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java
index 7dc815338..9bfc2f9c9 100644
--- a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java
@@ -68,7 +68,7 @@ public interface ILaunchObject extends Comparable<ILaunchObject> {
public boolean canTerminate();
/**
- * Terminates any running instance of this {@link ILaunchObject}.
+ * Terminates all running instances of this {@link ILaunchObject}.
*/
public void terminate();

Back to the top