Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2004-08-27 19:22:24 +0000
committerDarin Wright2004-08-27 19:22:24 +0000
commit09a07cfebd590a8cbd3253f96b61bbcfaf6d448d (patch)
tree054d064da084f275acc236b90f40a79134acf290
parent5727f528d4aa3c1ecb8630d27ced3f9b8965f15a (diff)
downloadeclipse.platform.debug-09a07cfebd590a8cbd3253f96b61bbcfaf6d448d.tar.gz
eclipse.platform.debug-09a07cfebd590a8cbd3253f96b61bbcfaf6d448d.tar.xz
eclipse.platform.debug-09a07cfebd590a8cbd3253f96b61bbcfaf6d448d.zip
Bug 27895 - Add new command to Run-menu; Resume All Threadsv20040827-pre-console-release
-rw-r--r--org.eclipse.debug.ui/plugin.properties1
-rw-r--r--org.eclipse.debug.ui/plugin.xml36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeActionDelegate.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeAllThreadsActionDelegate.java75
4 files changed, 53 insertions, 125 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties
index 2cfd8f2e5..e4edf28a1 100644
--- a/org.eclipse.debug.ui/plugin.properties
+++ b/org.eclipse.debug.ui/plugin.properties
@@ -82,7 +82,6 @@ RemoveBreakpointAction.tooltip=Remove Selected Breakpoints
RemoveExpressionAction.tooltip=Remove Selected Expressions
ResumeAction.label=Resu&me
ResumeAction.tooltip=Resume
-ResumeAllThreadsAction.label=Resume &All Threads
RunDropDownAction.label=&Run
RunMenu.label=&Run
RunLastAction.label=&Run Last Launched
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index bf01097a9..1a648d83e 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -255,17 +255,6 @@
menubarPath="org.eclipse.ui.run/stepGroup">
</action>
<action
- id="org.eclipse.debug.ui.actions.ResumeAllThreads"
- hoverIcon="icons/full/elcl16/resume_co.gif"
- class="org.eclipse.debug.internal.ui.actions.ResumeAllThreadsActionDelegate"
- definitionId="org.eclipse.debug.ui.commands.ResumeAllThreads"
- disabledIcon="icons/full/dlcl16/resume_co.gif"
- icon="icons/full/elcl16/resume_co.gif"
- helpContextId="resume_all_thraeds_action_context"
- label="%ResumeAllThreadsAction.label"
- menubarPath="org.eclipse.ui.run/stepGroup">
- </action>
- <action
id="org.eclipse.debug.ui.actions.Resume"
hoverIcon="icons/full/elcl16/resume_co.gif"
class="org.eclipse.debug.internal.ui.actions.ResumeActionDelegate"
@@ -936,19 +925,6 @@
</selection>
</action>
<action
- label="%ResumeAllThreadsAction.label"
- icon="icons/full/elcl16/resume_co.gif"
- helpContextId="resume__all_threads_action_context"
- definitionId="org.eclipse.debug.ui.commands.ResumeAllThreads"
- class="org.eclipse.debug.internal.ui.actions.ResumeAllThreadsActionDelegate"
- menubarPath="threadGroup"
- enablesFor="1"
- id="org.eclipse.debug.ui.debugview.popupMenu.resumeAllThreads">
- <selection
- class="org.eclipse.debug.core.model.IDebugElement">
- </selection>
- </action>
- <action
label="%ResumeAction.label"
icon="icons/full/elcl16/resume_co.gif"
helpContextId="resume_action_context"
@@ -1334,18 +1310,6 @@ M4 = Platform-specific fourth key
configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
</keyBinding>
<command
- name="%ActionDefinition.resumeAllThreads.name"
- category="org.eclipse.debug.ui.category.run"
- description="%ActionDefinition.resumeAllThreads.description"
- id="org.eclipse.debug.ui.commands.ResumeAllThreads">
- </command>
- <keyBinding
- keySequence="M1+F8"
- scope="org.eclipse.debug.ui.debugging"
- command="org.eclipse.debug.ui.commands.ResumeAllThreads"
- configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
- </keyBinding>
- <command
name="%ActionDefinition.terminate.name"
category="org.eclipse.debug.ui.category.run"
description="%ActionDefinition.terminate.description"
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeActionDelegate.java
index c2412cb8a..cc8864d7f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeActionDelegate.java
@@ -12,8 +12,11 @@ package org.eclipse.debug.internal.ui.actions;
import java.util.Iterator;
+
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.core.model.IThread;
import org.eclipse.jface.viewers.IStructuredSelection;
public class ResumeActionDelegate extends AbstractListenerActionDelegate {
@@ -22,12 +25,31 @@ public class ResumeActionDelegate extends AbstractListenerActionDelegate {
* @see AbstractDebugActionDelegate#doAction(Object)
*/
protected void doAction(Object object) throws DebugException {
- if (object instanceof ISuspendResume) {
- ISuspendResume resume = (ISuspendResume)object;
- if(resume.canResume()) {
- resume.resume();
- }
- }
+ if (isEnabledFor(object)) {
+ ISuspendResume resume = (ISuspendResume)object;
+ resume.resume();
+ } else {
+ doActionForAllThreads(object);
+ }
+ }
+
+ /**
+ * Resumes all threads in the target associated with the given element
+ *
+ * @param object debug element
+ * @throws DebugException on failure
+ */
+ protected void doActionForAllThreads(Object object) throws DebugException {
+ if (isEnabledForAllThreads(object)) {
+ IDebugElement debugElement = (IDebugElement) object;
+ IThread[] threads = debugElement.getDebugTarget().getThreads();
+ for (int i = 0; i < threads.length; i++) {
+ IThread thread = threads[i];
+ if (thread.canResume()) {
+ thread.resume();
+ }
+ }
+ }
}
/**
@@ -48,20 +70,38 @@ public class ResumeActionDelegate extends AbstractListenerActionDelegate {
* @see AbstractDebugActionDelegate#getEnableStateForSelection(IStructuredSelection)
*/
protected boolean getEnableStateForSelection(IStructuredSelection selection) {
- boolean enabled = false;
+ if (selection.isEmpty()) {
+ return false;
+ }
for (Iterator i = selection.iterator(); i.hasNext(); ) {
Object element = i.next();
- if (!(element instanceof ISuspendResume)) {
- return false; //all elements should be IStructuredSelection
- }
- if (!enabled && isEnabledFor(element)) {
- enabled = true;
+ if (!(isEnabledFor(element) || isEnabledForAllThreads(element))) {
+ return false;
}
}
- return enabled;
+ return true;
}
/**
+ * Returns whether 'resume all threads' should be enabled for the given element.
+ */
+ protected boolean isEnabledForAllThreads(Object element) {
+ if (element instanceof IDebugElement) {
+ IDebugElement debugElement = (IDebugElement) element;
+ try {
+ IThread[] threads = debugElement.getDebugTarget().getThreads();
+ for (int i = 0; i < threads.length; i++) {
+ if (threads[i].canResume()) {
+ return true;
+ }
+ }
+ } catch (DebugException e) {
+ }
+ }
+ return false;
+ }
+
+ /**
* @see AbstractDebugActionDelegate#getStatusMessage()
*/
protected String getStatusMessage() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeAllThreadsActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeAllThreadsActionDelegate.java
deleted file mode 100644
index cdb96aa1a..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ResumeAllThreadsActionDelegate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.actions;
-
-
-import java.util.Iterator;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-public class ResumeAllThreadsActionDelegate extends ResumeActionDelegate {
-
- /**
- * @see AbstractDebugActionDelegate#doAction(Object)
- */
- protected void doAction(Object object) throws DebugException {
- if (object instanceof IDebugElement) {
- IDebugElement debugElement = (IDebugElement) object;
- IThread[] threads = debugElement.getDebugTarget().getThreads();
- for (int i = 0; i < threads.length; i++) {
- IThread thread = threads[i];
- if (thread.canResume()) {
- thread.resume();
- }
- }
- }
- }
-
- /**
- * @see AbstractDebugActionDelegate#isEnabledFor(Object)
- */
- protected boolean isEnabledFor(Object element) {
- if (element instanceof IDebugElement) {
- IDebugElement debugElement = (IDebugElement) element;
- try {
- IThread[] threads = debugElement.getDebugTarget().getThreads();
- for (int i = 0; i < threads.length; i++) {
- if (threads[i].canResume()) {
- return true;
- }
- }
- } catch (DebugException e) {
- }
- }
- return false;
- }
-
- /**
- * @see AbstractDebugActionDelegate#getEnableStateForSelection(IStructuredSelection)
- */
- protected boolean getEnableStateForSelection(IStructuredSelection selection) {
- boolean enabled = false;
- for (Iterator i = selection.iterator(); i.hasNext(); ) {
- Object element = i.next();
- if (!(element instanceof IDebugElement)) {
- return false; //all elements should be IStructuredSelection
- }
- if (!enabled && isEnabledFor(element)) {
- enabled = true;
- }
- }
- return enabled;
- }
-
-}

Back to the top