Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java
new file mode 100644
index 000000000..ae6f1ba96
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java
@@ -0,0 +1,66 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.*;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Terminates all launches.
+ */
+public class TerminateAllAction extends Action implements IUpdate {
+
+ private static final String PREFIX= "terminate_all_action.";
+ private static final String STATUS= "status";
+ private static final String ERROR= "error.";
+
+ public TerminateAllAction() {
+ super(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches= lManager.getLaunches();
+ MultiStatus ms = new MultiStatus(DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
+ IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(PREFIX + STATUS), null);
+ for (int i= 0; i < launches.length; i++) {
+ ILaunch launch= (ILaunch) launches[i];
+ if (!launch.isTerminated()) {
+ try {
+ launch.terminate();
+ } catch (DebugException de) {
+ ms.merge(de.getStatus());
+ }
+ }
+ }
+ if (!ms.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), PREFIX + ERROR, ms);
+ }
+ }
+
+ /**
+ * @see IUpdate
+ */
+ public void update() {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches= lManager.getLaunches();
+ for (int i= 0; i< launches.length; i++) {
+ ILaunch launch= launches[i];
+ if (!launch.isTerminated()) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+}
+

Back to the top