Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2006-10-16 18:47:29 +0000
committercvs2svn2006-10-16 18:47:29 +0000
commit7ca596fe4811c5eaff3ad7bbabdb3395da730c8f (patch)
tree38dbf1844a840176f0bbe8dc6f6864dc8c1c469f
parent2991b85318abdb9760ad6da7392c0b8c18f22d5c (diff)
downloadeclipse.platform.debug-7ca596fe4811c5eaff3ad7bbabdb3395da730c8f.tar.gz
eclipse.platform.debug-7ca596fe4811c5eaff3ad7bbabdb3395da730c8f.tar.xz
eclipse.platform.debug-7ca596fe4811c5eaff3ad7bbabdb3395da730c8f.zip
This commit was manufactured by cvs2svn to create branch
'viewer_rework_3_3'. Cherrypick from master 2006-10-16 18:47:27 UTC Darin Wright <darin> 'Bug 160932 API for debug context and debug commands': org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DebugCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DropToFrameCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/ResumeCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepFiltersCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepIntoCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepOverCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepReturnCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/SuspendCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/TerminateCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/AbstractRequestMonitor.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionAdapterFactory.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionRequestMonitor.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/BooleanRequestMonitor.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/CommandMonitor.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ProxyBooleanRequestMonitor.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IBooleanRequestMonitor.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDebugCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDisconnectCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDropToFrameCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IResumeCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepFiltersCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepIntoCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepOverCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepReturnCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ISuspendCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ITerminateCommand.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DebugCommand.java147
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DropToFrameCommand.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/ResumeCommand.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepCommand.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepFiltersCommand.java81
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepIntoCommand.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepOverCommand.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepReturnCommand.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/SuspendCommand.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/TerminateCommand.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/AbstractRequestMonitor.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionAdapterFactory.java131
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionRequestMonitor.java60
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/BooleanRequestMonitor.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/CommandMonitor.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java269
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java126
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java205
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ProxyBooleanRequestMonitor.java86
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java63
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java63
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java123
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java111
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java94
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java80
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IBooleanRequestMonitor.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDebugCommand.java39
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDisconnectCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDropToFrameCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IResumeCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepFiltersCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepIntoCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepOverCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepReturnCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ISuspendCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ITerminateCommand.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java88
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java105
54 files changed, 3252 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DebugCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DebugCommand.java
new file mode 100644
index 000000000..d838317d7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DebugCommand.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.commands.provisional.IBooleanRequestMonitor;
+import org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand;
+import org.eclipse.debug.internal.ui.viewers.AsynchronousSchedulingRuleFactory;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Common function for standard debug commands.
+ *
+ * @since 3.3
+ *
+ */
+public abstract class DebugCommand implements IDebugCommand {
+
+ // debug flag
+ public static boolean DEBUG_COMMANDS = false;
+
+ static {
+ DEBUG_COMMANDS = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$
+ Platform.getDebugOption("org.eclipse.debug.ui/debug/commands")); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand#performCapability(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor)
+ */
+ public void execute(final Object element, final IAsynchronousRequestMonitor requestMonitor) {
+ Job job = new Job("execute command") { //$NON-NLS-1$
+ protected IStatus run(IProgressMonitor monitor) {
+ if (DEBUG_COMMANDS) {
+ System.out.println("execute: " + DebugCommand.this); //$NON-NLS-1$
+ }
+ Object target = getTarget(element);
+ if (target != null) {
+ try {
+ doExecute(target, requestMonitor);
+ } catch (CoreException e) {
+ requestMonitor.setStatus(e.getStatus());
+ if (DEBUG_COMMANDS) {
+ System.out.println("\t" + e.getStatus().getMessage()); //$NON-NLS-1$
+ }
+ }
+ } else {
+ requestMonitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element did not adapt to capability", //$NON-NLS-1$
+ null));
+ }
+ requestMonitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.schedule();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand#checkCapability(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor)
+ */
+ public void canExecute(final Object element, final IBooleanRequestMonitor requestMonitor) {
+ Job job = new Job("check command") { //$NON-NLS-1$
+ protected IStatus run(IProgressMonitor monitor) {
+ if (DEBUG_COMMANDS) {
+ System.out.print("can execute command: " + DebugCommand.this); //$NON-NLS-1$
+ }
+ Object target = getTarget(element);
+ if (target != null) {
+ try {
+ boolean executable = isExecutable(target, requestMonitor);
+ if (DEBUG_COMMANDS) {
+ System.out.println(" >> " + executable); //$NON-NLS-1$
+ }
+ requestMonitor.setResult(executable);
+ } catch (CoreException e) {
+ requestMonitor.setStatus(e.getStatus());
+ if (DEBUG_COMMANDS) {
+ System.out.println(" >> ABORTED"); //$NON-NLS-1$
+ System.out.println("\t" + e.getStatus().getMessage()); //$NON-NLS-1$
+ }
+ }
+ } else {
+ requestMonitor.setResult(false);
+ if (DEBUG_COMMANDS) {
+ System.out.println(" >> false (no adapter)"); //$NON-NLS-1$
+ }
+ }
+ requestMonitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.setRule(createUpdateSchedulingRule(element));
+ job.schedule();
+
+ }
+
+ /**
+ * Executes the actual operation.
+ *
+ * @param target object to perform on
+ * @param monitor progress monitor
+ */
+ protected abstract void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException;
+
+ /**
+ * Returns whether this command is executable.
+ *
+ * @param target object to check command for
+ * @param monitor progress monitor
+ * @return whether this command can be executed
+ */
+ protected abstract boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException;
+
+ /**
+ * Returns the appropriate command adapter from the given object.
+ *
+ * @param element object to obtain adapter from
+ * @return adapter
+ */
+ protected abstract Object getTarget(Object element);
+
+ /**
+ * Scheduling rule for checking capability.
+ *
+ * @return scheduling rule or <code>null</code>
+ */
+ protected ISchedulingRule createUpdateSchedulingRule(Object element) {
+ return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(element);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java
new file mode 100644
index 000000000..cf01524ff
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DisconnectCommand.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IDisconnect;
+import org.eclipse.debug.internal.ui.commands.provisional.IDisconnectCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default disconnect command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class DisconnectCommand extends DebugCommand implements IDisconnectCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((IDisconnect)target).canDisconnect();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((IDisconnect)target).disconnect();
+ }
+
+ protected Object getTarget(Object element) {
+ if (element instanceof IDisconnect) {
+ return element;
+ } else if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(IDisconnect.class);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DropToFrameCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DropToFrameCommand.java
new file mode 100644
index 000000000..8821a5c74
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/DropToFrameCommand.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IDropToFrame;
+import org.eclipse.debug.internal.ui.commands.provisional.IDropToFrameCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default drop to frame command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class DropToFrameCommand extends DebugCommand implements IDropToFrameCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((IDropToFrame)target).canDropToFrame();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((IDropToFrame)target).dropToFrame();
+ }
+
+ protected Object getTarget(Object element) {
+ if (element instanceof IDropToFrame) {
+ return element;
+ } else if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(IDropToFrame.class);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/ResumeCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/ResumeCommand.java
new file mode 100644
index 000000000..e75739737
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/ResumeCommand.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.internal.ui.commands.provisional.IResumeCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default resume command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class ResumeCommand extends SuspendCommand implements IResumeCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((ISuspendResume)target).canResume();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((ISuspendResume)target).resume();
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepCommand.java
new file mode 100644
index 000000000..6775b53f3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepCommand.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IStep;
+
+/**
+ * Common function for step commands.
+ *
+ * @since 3.3
+ */
+public abstract class StepCommand extends DebugCommand {
+
+ protected Object getTarget(Object element) {
+ if (element instanceof IStep) {
+ return element;
+ } else if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(IStep.class);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepFiltersCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepFiltersCommand.java
new file mode 100644
index 000000000..6394850ff
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepFiltersCommand.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStepFilters;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepFiltersCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.debug.ui.DebugUITools;
+
+/**
+ * Default toggle step filters command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class StepFiltersCommand extends DebugCommand implements IStepFiltersCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ IStepFilters[] filters = (IStepFilters[]) target;
+ for (int i = 0; i < filters.length; i++) {
+ IStepFilters filter = filters[i];
+ if (filter == null || !filter.supportsStepFilters()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ IStepFilters[] filters = (IStepFilters[]) target;
+ for (int i = 0; i < filters.length; i++) {
+ IStepFilters filter = filters[i];
+ filter.setStepFiltersEnabled(DebugUITools.isUseStepFilters());
+ }
+ }
+
+ protected Object getTarget(Object element) {
+ IDebugTarget[] targets = getDebugTargets(element);
+ if (targets.length > 0) {
+ IStepFilters[] filters = new IStepFilters[targets.length];
+ for (int i = 0; i < targets.length; i++) {
+ IDebugTarget target = targets[i];
+ if (target instanceof IStepFilters) {
+ filters[i] = (IStepFilters) target;
+ } else {
+ filters[i] = (IStepFilters) ((IAdaptable)element).getAdapter(IStepFilters.class);
+ }
+ }
+ return filters;
+ }
+ return new IStepFilters[0];
+ }
+
+ private IDebugTarget[] getDebugTargets(Object element) {
+ if (element instanceof IDebugElement) {
+ IDebugElement debugElement = (IDebugElement) element;
+ return new IDebugTarget[] { debugElement.getDebugTarget() };
+ } else if (element instanceof ILaunch) {
+ ILaunch launch = (ILaunch) element;
+ return launch.getDebugTargets();
+ } else if (element instanceof IProcess) {
+ IProcess process = (IProcess) element;
+ return process.getLaunch().getDebugTargets();
+ } else {
+ return new IDebugTarget[0];
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepIntoCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepIntoCommand.java
new file mode 100644
index 000000000..b419af29a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepIntoCommand.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IStep;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepIntoCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default step into command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class StepIntoCommand extends StepCommand implements IStepIntoCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((IStep)target).canStepInto();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((IStep)target).stepInto();
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepOverCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepOverCommand.java
new file mode 100644
index 000000000..335759a14
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepOverCommand.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IStep;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepOverCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default step over command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class StepOverCommand extends StepCommand implements IStepOverCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((IStep)target).canStepOver();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((IStep)target).stepOver();
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepReturnCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepReturnCommand.java
new file mode 100644
index 000000000..2b5f4057d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/StepReturnCommand.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IStep;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepReturnCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default step return command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class StepReturnCommand extends StepCommand implements IStepReturnCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((IStep)target).canStepReturn();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((IStep)target).stepReturn();
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/SuspendCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/SuspendCommand.java
new file mode 100644
index 000000000..6013edfbc
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/SuspendCommand.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.internal.ui.commands.provisional.ISuspendCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default suspend command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class SuspendCommand extends DebugCommand implements ISuspendCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((ISuspendResume)target).canSuspend();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((ISuspendResume)target).suspend();
+ }
+
+ protected Object getTarget(Object element) {
+ if (element instanceof ISuspendResume) {
+ return element;
+ } else if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(ISuspendResume.class);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/TerminateCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/TerminateCommand.java
new file mode 100644
index 000000000..6ca8f73f1
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/TerminateCommand.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.ITerminate;
+import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Default terminate command for the standard debug model.
+ *
+ * @since 3.3
+ */
+public class TerminateCommand extends DebugCommand implements ITerminateCommand {
+
+ protected boolean isExecutable(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ return ((ITerminate)target).canTerminate();
+ }
+
+ protected void doExecute(Object target, IAsynchronousRequestMonitor monitor) throws CoreException {
+ ((ITerminate)target).terminate();
+ }
+
+ protected Object getTarget(Object element) {
+ if (element instanceof ITerminate) {
+ return element;
+ } else if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(ITerminate.class);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/AbstractRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/AbstractRequestMonitor.java
new file mode 100644
index 000000000..bf06bda8a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/AbstractRequestMonitor.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Common function for request monitors
+ *
+ * @since 3.3
+ *
+ */
+public abstract class AbstractRequestMonitor implements IAsynchronousRequestMonitor {
+
+ private IStatus fStatus;
+ private boolean fCancelled = false;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor#setStatus(org.eclipse.core.runtime.IStatus)
+ */
+ public void setStatus(IStatus status) {
+ fStatus = status;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int)
+ */
+ public void beginTask(String name, int totalWork) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
+ */
+ public void internalWorked(double work) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled()
+ */
+ public boolean isCanceled() {
+ return fCancelled;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean)
+ */
+ public void setCanceled(boolean value) {
+ fCancelled = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
+ */
+ public void setTaskName(String name) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String)
+ */
+ public void subTask(String name) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
+ */
+ public void worked(int work) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor#getStatus()
+ */
+ public IStatus getStatus() {
+ return fStatus;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionAdapterFactory.java
new file mode 100644
index 000000000..ca6378ca8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionAdapterFactory.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDisconnect;
+import org.eclipse.debug.core.model.IDropToFrame;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStep;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.debug.core.model.ITerminate;
+import org.eclipse.debug.internal.ui.commands.DisconnectCommand;
+import org.eclipse.debug.internal.ui.commands.DropToFrameCommand;
+import org.eclipse.debug.internal.ui.commands.ResumeCommand;
+import org.eclipse.debug.internal.ui.commands.StepFiltersCommand;
+import org.eclipse.debug.internal.ui.commands.StepIntoCommand;
+import org.eclipse.debug.internal.ui.commands.StepOverCommand;
+import org.eclipse.debug.internal.ui.commands.StepReturnCommand;
+import org.eclipse.debug.internal.ui.commands.SuspendCommand;
+import org.eclipse.debug.internal.ui.commands.TerminateCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IDisconnectCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IDropToFrameCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IResumeCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepFiltersCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepIntoCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepOverCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepReturnCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.ISuspendCommand;
+import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
+
+/**
+ * Adapter factory for debug capabilities.
+ *
+ * @since 3.3
+ *
+ */
+public class ActionAdapterFactory implements IAdapterFactory {
+
+
+ private static ITerminateCommand fgTerminateCommand = new TerminateCommand();
+ private static IStepOverCommand fgStepOverCommand = new StepOverCommand();
+ private static IStepIntoCommand fgStepIntoCommand = new StepIntoCommand();
+ private static IStepReturnCommand fgStepReturnCommand = new StepReturnCommand();
+ private static IDropToFrameCommand fgDropToFrameCommand = new DropToFrameCommand();
+ private static IDisconnectCommand fgDisconnectCommand = new DisconnectCommand();
+ private static ISuspendCommand fgSuspendCommand = new SuspendCommand();
+ private static IResumeCommand fgResumeCommand = new ResumeCommand();
+ private static IStepFiltersCommand fgStepFiltersCommand = new StepFiltersCommand();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (IStepFiltersCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof IDebugElement ||
+ adaptableObject instanceof ILaunch ||
+ adaptableObject instanceof IProcess) {
+ return fgStepFiltersCommand;
+ }
+ }
+
+ if (ITerminateCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof ITerminate) {
+ return fgTerminateCommand;
+ }
+ }
+ if (IStepOverCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof IStep) {
+ return fgStepOverCommand;
+ }
+ }
+ if (IStepIntoCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof IStep) {
+ return fgStepIntoCommand;
+ }
+ }
+ if (IStepReturnCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof IStep) {
+ return fgStepReturnCommand;
+ }
+ }
+ if (ISuspendCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof ISuspendResume) {
+ return fgSuspendCommand;
+ }
+ }
+ if (IResumeCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof ISuspendResume) {
+ return fgResumeCommand;
+ }
+ }
+ if (IDisconnectCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof IDisconnect) {
+ return fgDisconnectCommand;
+ }
+ }
+ if (IDropToFrameCommand.class.equals(adapterType)) {
+ if (adaptableObject instanceof IDropToFrame) {
+ return fgDropToFrameCommand;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[]{
+ ITerminateCommand.class,
+ IStepOverCommand.class,
+ IStepIntoCommand.class,
+ IStepReturnCommand.class,
+ ISuspendCommand.class,
+ IResumeCommand.class,
+ IDropToFrameCommand.class,
+ IDisconnectCommand.class,
+ IStepFiltersCommand.class};
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionRequestMonitor.java
new file mode 100644
index 000000000..9a9de76d3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionRequestMonitor.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.internal.ui.DebugUIMessages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+/**
+ * Plain request monitor for actions. Has no result.
+ *
+ * @since 3.3
+ *
+ */
+public class ActionRequestMonitor extends AbstractRequestMonitor {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IProgressMonitor#done()
+ */
+ public void done() {
+ final IStatus status = getStatus();
+ if (status != null) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openError(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
+ }
+ });
+ break;
+ case IStatus.WARNING:
+ DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openWarning(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
+ }
+ });
+ break;
+ case IStatus.INFO:
+ DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openInformation(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage());
+ }
+ });
+ break;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/BooleanRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/BooleanRequestMonitor.java
new file mode 100644
index 000000000..ae6d99a69
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/BooleanRequestMonitor.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.commands.provisional.IBooleanRequestMonitor;
+import org.eclipse.jface.action.IAction;
+
+/**
+ * Boolean request monitor that collects boolean results from a number of voters.
+ * Request is cancelled when one voter votes false.
+ *
+ * @since 3.3
+ *
+ */
+public class BooleanRequestMonitor extends AbstractRequestMonitor implements IBooleanRequestMonitor {
+
+ private IAction fAction;
+ private int fNumVoters;
+ private int fNumOfVotes = 0;
+
+ public BooleanRequestMonitor(IAction action, int numVoters) {
+ fAction = action;
+ fNumVoters = numVoters;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor#setResult(boolean)
+ */
+ public void setResult(boolean result) {
+ fNumOfVotes++;
+ if (!isCanceled()) {
+ if (!result) {
+ setCanceled(true);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#done()
+ */
+ public void done() {
+ if (isCanceled()) {
+ fAction.setEnabled(false);
+ } else {
+ fAction.setEnabled(fNumOfVotes == fNumVoters);
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/CommandMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/CommandMonitor.java
new file mode 100644
index 000000000..c037ff2ed
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/CommandMonitor.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.commands.provisional.IBooleanRequestMonitor;
+import org.eclipse.jface.action.IAction;
+
+/**
+ * Request monitor for a command action.
+ *
+ * @since 3.3
+ */
+public class CommandMonitor extends AbstractRequestMonitor implements IBooleanRequestMonitor {
+
+ private IAction fAction;
+
+ public CommandMonitor(IAction action) {
+ fAction = action;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor#setResult(boolean)
+ */
+ public void setResult(boolean result) {
+ setCanceled(!result);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#done()
+ */
+ public void done() {
+ fAction.setEnabled(!isCanceled());
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java
new file mode 100644
index 000000000..230908e5d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandAction.java
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand;
+import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
+import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
+import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager;
+import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Abstract base class for actions performing debug commands
+ *
+ * @since 3.3
+ */
+public abstract class DebugCommandAction extends Action implements IDebugContextListener {
+
+ /**
+ * The window this action is working for.
+ */
+ private IWorkbenchWindow fWindow;
+
+ /**
+ * The part this action is working for, or <code>null</code> if global to
+ * a window.
+ */
+ private IWorkbenchPart fPart;
+
+ /**
+ * Command service.
+ */
+ private DebugCommandService fUpdateService;
+
+ /**
+ * Delegate this action is working for or <code>null</code> if none.
+ */
+ private DebugCommandActionDelegate fDelegate;
+
+ /**
+ * Constructor
+ */
+ public DebugCommandAction() {
+ super();
+ String helpContextId = getHelpContextId();
+ if (helpContextId != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, helpContextId);
+ setEnabled(false);
+ }
+
+ /**
+ * Set the current delegate
+ * @param delegate
+ */
+ public void setDelegate(DebugCommandActionDelegate delegate) {
+ fDelegate = delegate;
+ }
+
+ /**
+ * This method is analagous to the standard 'run' method for an <code>IAction</code>
+ * @param target the target to perform the action on
+ */
+ protected void execute(Object target) {
+ if (target instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) target;
+ IDebugCommand capability = (IDebugCommand) adaptable.getAdapter(getCommandType());
+ if (capability != null) {
+ capability.execute(target, createStatusMonitor(target));
+ }
+ }
+ }
+
+ /**
+ * Creates and returns the status monitor to execute this action with.
+ *
+ * @param target target of the command
+ * @return status monitor to execute with
+ */
+ protected IAsynchronousRequestMonitor createStatusMonitor(Object target) {
+ return new ActionRequestMonitor();
+ }
+
+ /**
+ * Returns the command type this action executes.
+ *
+ * @return command class.
+ */
+ abstract protected Class getCommandType();
+
+ public void contextActivated(ISelection context, IWorkbenchPart part) {
+ fUpdateService.postUpdateCommand(getCommandType(), new CommandMonitor(this));
+ }
+
+ public void contextChanged(ISelection context, IWorkbenchPart part) {
+ contextActivated(context, part);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#setEnabled(boolean)
+ */
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ if (fDelegate != null) {
+ fDelegate.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * Initializes this action for a specific part.
+ *
+ * @param part workbench part
+ */
+ public void init(IWorkbenchPart part) {
+ fPart = part;
+ fWindow = part.getSite().getWorkbenchWindow();
+ fUpdateService = DebugCommandService.getService(fWindow);
+ IDebugContextService service = DebugContextManager.getDefault().getContextService(fWindow);
+ String partId = part.getSite().getId();
+ service.addDebugContextListener(this, partId);
+ ISelection activeContext = service.getActiveContext(partId);
+ if (activeContext != null) {
+ fUpdateService.updateCommand(getCommandType(), new CommandMonitor(this));
+ } else {
+ setEnabled(getInitialEnablement());
+ }
+ }
+
+ /**
+ * Initializes the context action
+ * @param window the window
+ */
+ public void init(IWorkbenchWindow window) {
+ fWindow = window;
+ fUpdateService = DebugCommandService.getService(fWindow);
+ IDebugContextManager manager = DebugContextManager.getDefault();
+ manager.addDebugContextListener(this, window);
+ ISelection activeContext = manager.getActiveContext(window);
+ if (activeContext != null) {
+ fUpdateService.updateCommand(getCommandType(), new BooleanRequestMonitor(this, 1));
+ } else {
+ setEnabled(getInitialEnablement());
+ }
+ }
+
+ /**
+ * Returns whether this action should be enabled when initialized
+ * and there is no active debug context.
+ *
+ * @return false, by default
+ */
+ protected boolean getInitialEnablement() {
+ return false;
+ }
+
+ /**
+ * Returns the most recent selection
+ *
+ * @return structured selection
+ */
+ protected ISelection getContext() {
+ if (fPart != null) {
+ DebugContextManager.getDefault().getContextService(fWindow).getActiveContext(fPart.getSite().getId());
+ }
+ return DebugContextManager.getDefault().getActiveContext(fWindow);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run() {
+ ISelection selection = getContext();
+ if (selection instanceof IStructuredSelection && isEnabled()) {
+ // disable the action so it cannot be run again until an event or
+ // selection change updates the enablement
+ setEnabled(false);
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ for (Iterator iter = ss.iterator(); iter.hasNext();) {
+ Object element = iter.next();
+ execute(element);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(Event event) {
+ run();
+ }
+
+ /**
+ * Clean up when removing
+ */
+ public void dispose() {
+ IDebugContextManager manager = DebugContextManager.getDefault();
+ if (fPart != null) {
+ IDebugContextService service = manager.getContextService(fWindow);
+ service.removeDebugContextListener(this, fPart.getSite().getId());
+ } else {
+ manager.removeDebugContextListener(this, fWindow);
+ }
+ fWindow = null;
+ fPart = null;
+ }
+
+ /**
+ * @return The help context id for this action
+ */
+ public abstract String getHelpContextId();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getId()
+ */
+ public abstract String getId();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getText()
+ */
+ public abstract String getText();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getToolTipText()
+ */
+ public abstract String getToolTipText();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
+ */
+ public abstract ImageDescriptor getDisabledImageDescriptor();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getHoverImageDescriptor()
+ */
+ public abstract ImageDescriptor getHoverImageDescriptor();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ public abstract ImageDescriptor getImageDescriptor();
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java
new file mode 100644
index 000000000..db973418d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * Abstract base class for debug action delegates performing debug commands.
+ *
+ * @since 3.3
+ */
+public abstract class DebugCommandActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2 {
+
+ /**
+ *The real action for this delegate
+ */
+ private DebugCommandAction fDebugAction;
+
+ /**
+ * The underlying action for this delegate
+ */
+ private IAction fWindowAction;
+
+ /**
+ * Whether this action has been initialized before it has been run
+ * (ensures enablement state is up to date when lazily instantiated)
+ */
+ private boolean fInitialized = false;
+
+ public DebugCommandActionDelegate() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose() {
+ fDebugAction.dispose();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ fWindowAction = action;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+ fDebugAction.init(window);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public synchronized void run(IAction action) {
+ if (!fInitialized) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ fDebugAction.run();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection s) {
+ // do nothing
+ }
+
+ protected DebugCommandAction getAction() {
+ return fDebugAction;
+ }
+
+ protected void setAction(DebugCommandAction action) {
+ fDebugAction = action;
+ action.setDelegate(this);
+ }
+
+ public synchronized void setEnabled(boolean enabled) {
+ if (!fInitialized) {
+ fInitialized = true;
+ notifyAll();
+ }
+ fWindowAction.setEnabled(enabled);
+ }
+
+ protected IAction getWindowAction()
+ {
+ return fWindowAction;
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
new file mode 100644
index 000000000..2ef382fe7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.internal.ui.commands.provisional.IBooleanRequestMonitor;
+import org.eclipse.debug.internal.ui.commands.provisional.IDebugCommand;
+import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
+import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
+import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Updates commands for a window. Coalesces update requests by command type.
+ *
+ * @since 3.3
+ */
+public class DebugCommandService implements IDebugContextListener {
+
+ /**
+ * Maps command types to update monitors
+ */
+ private Map fCommandUpdates = new HashMap();
+
+ /**
+ * Window this service is for.
+ */
+ private IWorkbenchWindow fWindow = null;
+
+ /**
+ * The context service for this command service.
+ */
+ private IDebugContextService fContextService = null;
+
+ /**
+ * Service per window
+ */
+ private static Map fgServices = new HashMap();
+
+ /**
+ * Returns the service for a window.
+ *
+ * @param window
+ * @return service
+ */
+ public synchronized static DebugCommandService getService(IWorkbenchWindow window) {
+ DebugCommandService service = (DebugCommandService) fgServices.get(window);
+ if (service == null) {
+ service = new DebugCommandService(window);
+ fgServices.put(window, service);
+ }
+ return service;
+ }
+
+ public DebugCommandService(IWorkbenchWindow window) {
+ fWindow = window;
+ fContextService = DebugContextManager.getDefault().getContextService(window);
+ fContextService.addPostDebugContextListener(this);
+ PlatformUI.getWorkbench().addWindowListener(new IWindowListener() {
+
+ public void windowOpened(IWorkbenchWindow window) {
+ }
+
+ public void windowDeactivated(IWorkbenchWindow window) {
+ }
+
+ public void windowClosed(IWorkbenchWindow window) {
+ if (fWindow == window) {
+ dispose();
+ }
+ }
+
+ public void windowActivated(IWorkbenchWindow window) {
+ }
+
+ });
+ }
+
+ private void dispose() {
+ fContextService.removeDebugContextListener(this);
+ fgServices.remove(fWindow);
+ fCommandUpdates.clear();
+ fWindow = null;
+ }
+
+ /**
+ * Updates the given command type after the next context change.
+ *
+ * @param commandType
+ * @param monitor
+ */
+ public void postUpdateCommand(Class commandType, IBooleanRequestMonitor monitor) {
+ ProxyBooleanRequestMonitor proxy = (ProxyBooleanRequestMonitor) fCommandUpdates.get(commandType);
+ if (proxy == null) {
+ proxy = new ProxyBooleanRequestMonitor();
+ fCommandUpdates.put(commandType, proxy);
+ }
+ proxy.addMonitor(monitor);
+ }
+
+ /**
+ * Updates the given command type based on the active context.
+ *
+ * @param commandType
+ * @param requestMonitor
+ */
+ public void updateCommand(Class commandType, IBooleanRequestMonitor requestMonitor) {
+ ISelection context = fContextService.getActiveContext();
+ if (context instanceof IStructuredSelection && !context.isEmpty()) {
+ Object[] elements = ((IStructuredSelection)context).toArray();
+ ProxyBooleanRequestMonitor monitor = new ProxyBooleanRequestMonitor();
+ monitor.addMonitor(requestMonitor);
+ updateCommand(commandType, elements, monitor);
+ } else {
+ requestMonitor.setCanceled(true);
+ requestMonitor.done();
+ }
+ }
+
+ private void postUpdate(ISelection context) {
+ if (context instanceof IStructuredSelection && !context.isEmpty()) {
+ Object[] elements = ((IStructuredSelection)context).toArray();
+ Iterator iterator = fCommandUpdates.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+ Class commandType = (Class)entry.getKey();
+ ProxyBooleanRequestMonitor monitor = (ProxyBooleanRequestMonitor) entry.getValue();
+ updateCommand(commandType, elements, monitor);
+ }
+ } else {
+ Iterator iterator = fCommandUpdates.values().iterator();
+ while (iterator.hasNext()) {
+ ProxyBooleanRequestMonitor monitor = (ProxyBooleanRequestMonitor) iterator.next();
+ monitor.setCanceled(true);
+ monitor.done();
+ }
+ }
+ fCommandUpdates.clear();
+ }
+
+ /**
+ * Updates the given command type for the specified elements.
+ *
+ * @param commandType command class to update
+ * @param elements elements to update for
+ * @param monitor status monitor
+ */
+ private void updateCommand(Class commandType, Object[] elements, ProxyBooleanRequestMonitor monitor) {
+ IDebugCommand[] commands = new IDebugCommand[elements.length];
+ int numVoters = 0;
+ for (int i = 0; i < elements.length; i++) {
+ Object element = elements[i];
+ if (element instanceof IAdaptable) {
+ IDebugCommand command = (IDebugCommand) ((IAdaptable)element).getAdapter(commandType);
+ if (command != null) {
+ commands[i] = command;
+ numVoters++;
+ } else {
+ monitor.setCanceled(true);
+ monitor.done();
+ return;
+ }
+ }
+ }
+ if (!monitor.isCanceled()) {
+ monitor.setNumVoters(numVoters);
+ for (int i = 0; i < commands.length; i++) {
+ IDebugCommand command = commands[i];
+ command.canExecute(elements[i], monitor);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart, org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService)
+ */
+ public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ postUpdate(selection);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart, org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService)
+ */
+ public void contextChanged(ISelection selection, IWorkbenchPart part) {
+ postUpdate(selection);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java
new file mode 100644
index 000000000..8b3f43f04
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IDisconnectCommand;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+/**
+ * Disconnect action.
+ *
+ * @since 3.3
+ */
+public class DisconnectCommandAction extends DebugCommandAction{
+
+ public String getText() {
+ return ActionMessages.DisconnectAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "disconnect_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.disconnect"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.DisconnectAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT);
+ }
+
+ protected Class getCommandType() {
+ return IDisconnectCommand.class;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java
new file mode 100644
index 000000000..1f93ed617
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IDropToFrameCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Drop to frame action.
+ *
+ * @since 3.3
+ */
+public class DropToFrameCommandAction extends DebugCommandAction {
+
+ public String getText() {
+ return ActionMessages.DropToFrameAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "drop_to_frame_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.dropToFrame"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.DropToFrameAction_3;
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return null;
+ }
+
+ protected Class getCommandType() {
+ return IDropToFrameCommand.class;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ProxyBooleanRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ProxyBooleanRequestMonitor.java
new file mode 100644
index 000000000..257744464
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ProxyBooleanRequestMonitor.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.debug.internal.ui.commands.provisional.IBooleanRequestMonitor;
+
+/**
+ * Boolean request monitor that collects boolean results from a number of voters.
+ * Request is cancelled when one voter votes false. Forwards the results to
+ * any number of boolean request monitors.
+ *
+ * @since 3.3
+ *
+ */
+public class ProxyBooleanRequestMonitor extends AbstractRequestMonitor implements IBooleanRequestMonitor {
+
+ private List fMonitors = new ArrayList();
+ private int fNumVoters;
+ private int fNumOfVotes = 0;
+ private boolean fDone = false;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor#setResult(boolean)
+ */
+ public synchronized void setResult(boolean result) {
+ fNumOfVotes++;
+ if (!isCanceled()) {
+ if (!result) {
+ setCanceled(true);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IProgressMonitor#done()
+ */
+ public synchronized void done() {
+ if (!fDone) {
+ if (isCanceled() || fNumOfVotes == fNumVoters) {
+ fDone = true;
+ Iterator monitors = fMonitors.iterator();
+ while (monitors.hasNext()) {
+ IBooleanRequestMonitor monitor = (IBooleanRequestMonitor) monitors.next();
+ monitor.setStatus(getStatus());
+ if (isCanceled()) {
+ monitor.setCanceled(true);
+ } else {
+ monitor.setResult(true);
+ }
+ monitor.done();
+ }
+ fMonitors.clear();
+ }
+ }
+ }
+
+ /**
+ * Sets the number of voters required for this capability test.
+ *
+ * @param numVoters
+ */
+ void setNumVoters(int numVoters) {
+ fNumVoters = numVoters;
+ }
+
+ /**
+ * Adds the given monitor to forward the result to when done.
+ *
+ * @param monitor
+ */
+ void addMonitor(IBooleanRequestMonitor monitor) {
+ fMonitors.add(monitor);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java
new file mode 100644
index 000000000..5f1cf0cf3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IResumeCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Resume action.
+ *
+ * @since 3.3
+ */
+public class ResumeCommandAction extends DebugCommandAction{
+
+ public ResumeCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.Resume"); //$NON-NLS-1$
+ }
+
+ public String getText() {
+ return ActionMessages.ResumeAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "resume_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.resume"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.ResumeAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESUME);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME);
+ }
+
+ protected Class getCommandType() {
+ return IResumeCommand.class;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java
new file mode 100644
index 000000000..77a6cb6d2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Resume action delegate.
+ *
+ * @since 3.3
+ */
+public class ResumeCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public ResumeCommandActionDelegate() {
+ super();
+ setAction(new ResumeCommandAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java
new file mode 100644
index 000000000..45ae8d711
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepIntoCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Step into action
+ *
+ * @since 3.3
+ */
+public class StepIntoCommandAction extends DebugCommandAction {
+
+ public StepIntoCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.StepInto"); //$NON-NLS-1$
+ }
+
+ public String getText() {
+ return ActionMessages.StepIntoAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "step_into_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.stepInto"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.StepIntoAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_INTO);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO);
+ }
+
+ protected Class getCommandType() {
+ return IStepIntoCommand.class;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java
new file mode 100644
index 000000000..0364de6eb
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Step into action delegate.
+ *
+ * @since 3.3
+ */
+public class StepIntoCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public StepIntoCommandActionDelegate() {
+ super();
+ setAction(new StepIntoCommandAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java
new file mode 100644
index 000000000..e33e2e407
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepOverCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Step over action.
+ *
+ * @since 3.3
+ */
+public class StepOverCommandAction extends DebugCommandAction {
+
+ public StepOverCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.StepOver"); //$NON-NLS-1$
+ }
+
+ public String getText() {
+ return ActionMessages.StepOverAction_0;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_OVER);
+ }
+
+ public String getHelpContextId() {
+ return "step_over_action_context"; //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER);
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.stepOver"; //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER);
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.StepOverAction_3;
+ }
+
+ protected Class getCommandType() {
+ return IStepOverCommand.class;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java
new file mode 100644
index 000000000..71a20406d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Step over action delegate.
+ *
+ * @since 3.3
+ */
+public class StepOverCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public StepOverCommandActionDelegate() {
+ super();
+ setAction(new StepOverCommandAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java
new file mode 100644
index 000000000..7bf961264
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepReturnCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Step return action.
+ *
+ * @since 3.3
+ */
+public class StepReturnCommandAction extends DebugCommandAction {
+
+
+ public StepReturnCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.StepReturn"); //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_RETURN);
+ }
+
+ public String getHelpContextId() {
+ return "step_return_action_context"; //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.stepReturn"; //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.StepReturnAction_2;
+ }
+
+ public String getText() {
+ return ActionMessages.StepReturnAction_3;
+ }
+
+ protected Class getCommandType() {
+ return IStepReturnCommand.class;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java
new file mode 100644
index 000000000..2f78cced1
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Step return action delegate.
+ *
+ * @since 3.3
+ */
+public class StepReturnCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public StepReturnCommandActionDelegate() {
+ super();
+ setAction(new StepReturnCommandAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java
new file mode 100644
index 000000000..98602fd58
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.ISuspendCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Suspend action.
+ *
+ * @since 3.3
+ */
+public class SuspendCommandAction extends DebugCommandAction {
+
+
+ public String getText() {
+ return ActionMessages.SuspendAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "suspend_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.suspend"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.SuspendAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_SUSPEND);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND);
+ }
+
+ protected Class getCommandType() {
+ return ISuspendCommand.class;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java
new file mode 100644
index 000000000..9747cdc42
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Suspend action delegate.
+ *
+ * @since 3.3
+ */
+public class SuspendCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public SuspendCommandActionDelegate() {
+ super();
+ setAction(new SuspendCommandAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java
new file mode 100644
index 000000000..777167a50
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllAction.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Terminates all launches.
+ *
+ * @since 3.3
+ */
+public class TerminateAllAction extends DebugCommandAction implements ILaunchesListener2 {
+
+ protected ISelection getContext() {
+ return new StructuredSelection(getLaunchManager().getLaunches());
+ }
+
+ public void contextActivated(ISelection context, IWorkbenchPart part) {
+ // DO NOTHING
+ }
+
+ public void contextChanged(ISelection context, IWorkbenchPart part) {
+ // DO NOTHING
+ }
+
+ public void dispose() {
+ getLaunchManager().removeLaunchListener(this);
+ super.dispose();
+ }
+
+ public void init(IWorkbenchPart part) {
+ super.init(part);
+ ILaunchManager launchManager = getLaunchManager();
+ launchManager.addLaunchListener(this);
+ // heuristic... rather than updating all the time, just assume there's
+ // something that's not terminated.
+ setEnabled(launchManager.getLaunches().length > 0);
+ }
+
+ private ILaunchManager getLaunchManager() {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ public String getHelpContextId() {
+ return "terminate_all_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.popupMenu.terminateAll"; //$NON-NLS-1$
+ }
+
+ public String getText() {
+ return ActionMessages.TerminateAllAction_2;
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.TerminateAllAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages
+ .getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_ALL);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages
+ .getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_ALL);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages
+ .getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_ALL);
+ }
+
+ protected Class getCommandType() {
+ return ITerminateCommand.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchesListener2#launchesTerminated(org.eclipse.debug.core.ILaunch[])
+ */
+ public void launchesTerminated(ILaunch[] launches) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchesListener#launchesAdded(org.eclipse.debug.core.ILaunch[])
+ */
+ public void launchesAdded(ILaunch[] launches) {
+ setEnabled(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchesListener#launchesChanged(org.eclipse.debug.core.ILaunch[])
+ */
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchesListener#launchesRemoved(org.eclipse.debug.core.ILaunch[])
+ */
+ public void launchesRemoved(ILaunch[] launches) {
+ setEnabled(getLaunchManager().getLaunches().length > 0);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
new file mode 100644
index 000000000..146967d45
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.actions.RelaunchActionDelegate;
+import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Action which terminates a launch and then re-launches it.
+ */
+public class TerminateAndRelaunchAction extends DebugCommandAction {
+
+ class RequestMonitor extends ActionRequestMonitor {
+
+ private ILaunch fLaunch;
+
+ public RequestMonitor(ILaunch launch) {
+ fLaunch = launch;
+ }
+
+ public void done() {
+ super.done();
+ DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ // Must be run in the UI thread since the launch can require
+ // prompting to proceed
+ RelaunchActionDelegate.relaunch(fLaunch.getLaunchConfiguration(), fLaunch.getLaunchMode());
+ }
+ });
+ }
+
+ }
+
+ protected IAsynchronousRequestMonitor createStatusMonitor(Object target) {
+ ILaunch launch = RelaunchActionDelegate.getLaunch(target);
+ return new RequestMonitor(launch);
+ }
+
+ protected Class getCommandType() {
+ return ITerminateCommand.class;
+ }
+
+ public void contextActivated(ISelection context, IWorkbenchPart part) {
+ if (context instanceof IStructuredSelection) {
+ Object[] elements = ((IStructuredSelection)context).toArray();
+ for (int i = 0; i < elements.length; i++) {
+ if (!canRelaunch(elements[i])) {
+ setEnabled(false);
+ return;
+ }
+ }
+ }
+ super.contextActivated(context, part);
+ }
+
+ protected boolean canRelaunch(Object element) {
+ ILaunch launch = RelaunchActionDelegate.getLaunch(element);
+ return launch != null && LaunchConfigurationManager.isVisible(launch.getLaunchConfiguration());
+ }
+
+ public String getActionDefinitionId() {
+ return ActionMessages.TerminateAndRelaunchAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "terminate_and_relaunch_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.popupMenu.TerminateAndRelaunch"; //$NON-NLS-1$
+ }
+
+ public String getText() {
+ return ActionMessages.TerminateAndRelaunchAction_3;
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.TerminateAndRelaunchAction_4;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_RELAUNCH);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
new file mode 100644
index 000000000..19e9c0408
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Terminate and remove action.
+ *
+ * @since 3.3
+ */
+public class TerminateAndRemoveAction extends DebugCommandAction {
+
+
+ class TerminateAndRemoveMonitor extends ActionRequestMonitor {
+ private Object fElement;
+ TerminateAndRemoveMonitor(Object element) {
+ fElement = element;
+ }
+ public void done() {
+ IStatus status = getStatus();
+ if(status == null || status.isOK()) {
+ ILaunch launch= null;
+ if (fElement instanceof ILaunch) {
+ launch= (ILaunch) fElement;
+ } else if (fElement instanceof IDebugElement) {
+ launch= ((IDebugElement) fElement).getLaunch();
+ } else if (fElement instanceof IProcess) {
+ launch= ((IProcess) fElement).getLaunch();
+ }
+ if (launch != null)
+ DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
+ }
+ super.done();
+ }
+
+ }
+
+ public String getText() {
+ return ActionMessages.TerminateAndRemoveAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "terminate_and_remove_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.popupMenu.terminateAndRemove"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.TerminateAndRemoveAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_REMOVE);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE);
+ }
+
+ protected Class getCommandType() {
+ return ITerminateCommand.class;
+ }
+
+ protected IAsynchronousRequestMonitor createStatusMonitor(Object target) {
+ return new TerminateAndRemoveMonitor(target);
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java
new file mode 100644
index 000000000..07528acf4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.ITerminateCommand;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Terminate action.
+ *
+ * @since 3.3
+ */
+public class TerminateCommandAction extends DebugCommandAction {
+
+ public TerminateCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.Terminate"); //$NON-NLS-1$
+ }
+
+ public String getText() {
+ return ActionMessages.TerminateAction_0;
+ }
+
+ public String getHelpContextId() {
+ return "terminate_action_context"; //$NON-NLS-1$
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.debugview.toolbar.terminate"; //$NON-NLS-1$
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.TerminateAction_3;
+ }
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE);
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE);
+ }
+
+ protected Class getCommandType() {
+ return ITerminateCommand.class;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java
new file mode 100644
index 000000000..a401b2209
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Terminate action delegate.
+ *
+ * @since 3.3
+ */
+public class TerminateCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public TerminateCommandActionDelegate() {
+ super();
+ setAction(new TerminateCommandAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
new file mode 100644
index 000000000..85de71dea
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.commands.provisional.IStepFiltersCommand;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class ToggleStepFiltersAction extends DebugCommandAction {
+
+ public ImageDescriptor getDisabledImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TOGGLE_STEP_FILTERS);
+ }
+
+ public String getHelpContextId() {
+ return "step_with_filters_action_context"; //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getHoverImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TOGGLE_STEP_FILTERS);
+ }
+
+ public String getId() {
+ return "org.eclipse.debug.ui.actions.ToggleStepFilters"; //$NON-NLS-1$
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TOGGLE_STEP_FILTERS);
+ }
+
+ public String getText() {
+ return ActionMessages.ToggleStepFiltersAction_0;
+ }
+
+ public String getToolTipText() {
+ return ActionMessages.ToggleStepFiltersAction_0;
+ }
+
+ protected boolean getInitialEnablement() {
+ return true;
+ }
+
+ protected Class getCommandType() {
+ return IStepFiltersCommand.class;
+ }
+
+ public void run() {
+ DebugUITools.setUseStepFilters(!DebugUITools.isUseStepFilters());
+ }
+
+ public int getStyle() {
+ return AS_CHECK_BOX;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart, org.eclipse.debug.internal.ui.contexts.IDebugContextService)
+ */
+ public void contextActivated(ISelection context, IWorkbenchPart part) {
+ if (context.isEmpty()) {
+ setEnabled(true);
+ } else {
+ super.contextActivated(context, part);
+ }
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java
new file mode 100644
index 000000000..ad58f05af
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.internal.ui.commands.actions;
+
+/**
+ * Toggle step filters action delegate.
+ *
+ * @since 3.3
+ */
+public class ToggleStepFiltersCommandActionDelegate extends DebugCommandActionDelegate {
+
+ public ToggleStepFiltersCommandActionDelegate() {
+ super();
+ setAction(new ToggleStepFiltersAction());
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IBooleanRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IBooleanRequestMonitor.java
new file mode 100644
index 000000000..2618d52d6
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IBooleanRequestMonitor.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * Request monitor for obtaining a boolean result asynchronously.
+ *
+ * @since 3.3
+ */
+public interface IBooleanRequestMonitor extends IAsynchronousRequestMonitor {
+
+ /**
+ * Sets the result of a boolean request.
+ *
+ * @param result the result
+ */
+ public void setResult(boolean result);
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDebugCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDebugCommand.java
new file mode 100644
index 000000000..36598bf9c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDebugCommand.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor;
+
+/**
+ * A command that can be enabled or disabled and executed.
+ *
+ * @since 3.3
+ */
+public interface IDebugCommand {
+
+ /**
+ * Determines whether this command can be executed on the specified element.
+ *
+ * @param element element to operate on
+ * @param monitor accepts result
+ */
+ public void canExecute(Object element, IBooleanRequestMonitor monitor);
+
+ /**
+ * Executes this command on the specified element reporting any status
+ * to the given monitor.
+ *
+ * @param element element to perform capability on
+ * @param monitor status monitor
+ */
+ public void execute(Object element, IAsynchronousRequestMonitor monitor);
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDisconnectCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDisconnectCommand.java
new file mode 100644
index 000000000..2e0c03d7f
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDisconnectCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Disconnect command.
+ *
+ * @since 3.3
+ */
+public interface IDisconnectCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDropToFrameCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDropToFrameCommand.java
new file mode 100644
index 000000000..5eae61965
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IDropToFrameCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Drop to frame command.
+ *
+ * @since 3.3
+ */
+public interface IDropToFrameCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IResumeCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IResumeCommand.java
new file mode 100644
index 000000000..2838b9101
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IResumeCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Resume command.
+ *
+ * @since 3.3
+ */
+public interface IResumeCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepFiltersCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepFiltersCommand.java
new file mode 100644
index 000000000..f9bd5b39e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepFiltersCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Step filters command.
+ *
+ * @since 3.3
+ */
+public interface IStepFiltersCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepIntoCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepIntoCommand.java
new file mode 100644
index 000000000..e797e371c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepIntoCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Step into command.
+ *
+ * @since 3.3
+ */
+public interface IStepIntoCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepOverCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepOverCommand.java
new file mode 100644
index 000000000..b86dc92a8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepOverCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Step over command.
+ *
+ * @since 3.3
+ */
+public interface IStepOverCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepReturnCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepReturnCommand.java
new file mode 100644
index 000000000..373ef3ca3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/IStepReturnCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Step return command.
+ *
+ * @since 3.3
+ */
+public interface IStepReturnCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ISuspendCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ISuspendCommand.java
new file mode 100644
index 000000000..3380ba058
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ISuspendCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Suspend command.
+ *
+ * @since 3.3
+ */
+public interface ISuspendCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ITerminateCommand.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ITerminateCommand.java
new file mode 100644
index 000000000..39d0933d8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/provisional/ITerminateCommand.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.provisional;
+
+/**
+ * Terminate command.
+ *
+ * @since 3.3
+ */
+public interface ITerminateCommand extends IDebugCommand {
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java
new file mode 100644
index 000000000..5370af0ad
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/AbstractDebugContextProvider.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.contexts.provisional;
+
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Abstract implementation of a debug context provider.
+ * <p>
+ * Clients implementing context providers should subclass this class.
+ * </p>
+ * @since 3.3
+ */
+public abstract class AbstractDebugContextProvider implements IDebugContextProvider {
+
+ /**
+ * Event listeners
+ */
+ private ListenerList fListeners = new ListenerList();
+
+ /**
+ * Part or <code>null</code>
+ */
+ private IWorkbenchPart fPart;
+
+ /**
+ * Constructs a context provider for the specified part, possibly <code>null</code>.
+ *
+ * @param part workbench part or <code>null</code>
+ */
+ public AbstractDebugContextProvider(IWorkbenchPart part) {
+ fPart = part;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#addDebugContextEventListener(org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener)
+ */
+ public void addDebugContextEventListener(IDebugContextEventListener listener) {
+ fListeners.add(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#getPart()
+ */
+ public IWorkbenchPart getPart() {
+ return fPart;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#removeDebugContextEventListener(org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener)
+ */
+ public void removeDebugContextEventListener(IDebugContextEventListener listener) {
+ fListeners.remove(listener);
+ }
+
+ /**
+ * Fires the given context event to all listeners.
+ *
+ * @param event debug context event
+ */
+ protected void fire(final DebugContextEvent event) {
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ final IDebugContextEventListener listener = (IDebugContextEventListener) listeners[i];
+ SafeRunner.run(new ISafeRunnable() {
+ public void run() throws Exception {
+ listener.contextEvent(event);
+ }
+ public void handleException(Throwable exception) {
+ DebugUIPlugin.log(exception);
+ }
+ });
+
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java
new file mode 100644
index 000000000..a1ebea685
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/DebugContextEvent.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.contexts.provisional;
+
+import java.util.EventObject;
+
+import org.eclipse.jface.viewers.ISelection;
+
+/**
+ * A debug context event.
+ *
+ * @since 3.3
+ */
+public class DebugContextEvent extends EventObject {
+
+ /**
+ * The context
+ */
+ private ISelection fContext;
+
+ /**
+ * Type of context event - change or activation
+ */
+ private int fEventType;
+
+ /**
+ * Context activation event type.
+ */
+ public static final int ACTIVATED = 1;
+
+ /**
+ * Context change event type.
+ */
+ public static final int CHANGED = 2;
+
+ /**
+ * Generated serial version UID for this class.
+ */
+ private static final long serialVersionUID = 3395172504615255524L;
+
+ /**
+ * @param source
+ */
+ public DebugContextEvent(IDebugContextProvider source, ISelection context, int eventType) {
+ super(source);
+ fContext = context;
+ fEventType = eventType;
+ }
+
+ /**
+ * Returns the context associated with this event.
+ *
+ * @return
+ */
+ public ISelection getContext() {
+ return fContext;
+ }
+
+ /**
+ * Returns the event type.
+ *
+ * @return event type
+ */
+ public int getEventType() {
+ return fEventType;
+ }
+
+ /**
+ * Returns the context provider that initiated this event.
+ *
+ * @return context provider
+ */
+ public IDebugContextProvider getDebugContextProvider() {
+ return (IDebugContextProvider) getSource();
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java
new file mode 100644
index 000000000..a5238fdee
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextEventListener.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.contexts.provisional;
+
+
+/**
+ * Notified of context events by a debug context provider.
+ * <p>
+ * Clients are not intended to implement this interface.
+ * </p>
+ * @since 3.3
+ * @see IDebugContextManager
+ */
+public interface IDebugContextEventListener {
+
+ /**
+ * Notification of the specified debug context event.
+ *
+ * @param event debug context event
+ */
+ public void contextEvent(DebugContextEvent event);
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java
new file mode 100644
index 000000000..a7d7a4706
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextService.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.contexts.provisional;
+
+import org.eclipse.jface.viewers.ISelection;
+
+
+/**
+ * Debug context service for a window.
+ *
+ * @since 3.2
+ */
+public interface IDebugContextService {
+
+ /**
+ * Registers for context activation notification in this service.
+ *
+ * @param listener
+ */
+ public void addDebugContextListener(IDebugContextListener listener);
+ /**
+ * Unregisters for context activation notification in this service.
+ *
+ * @param listener
+ */
+ public void removeDebugContextListener(IDebugContextListener listener);
+
+ /**
+ * Registers for context activation notification in the specified part.
+ *
+ * @param listener
+ * @param partId
+ */
+ public void addDebugContextListener(IDebugContextListener listener, String partId);
+
+ /**
+ * Unregisters for context activation notification in the specified part.
+ *
+ * @param listener
+ * @param partId
+ */
+ public void removeDebugContextListener(IDebugContextListener listener, String partId);
+
+ /**
+ * Returns the active context in this service's window
+ * or <code>null</code>.
+ *
+ * @return
+ */
+ public ISelection getActiveContext();
+
+ /**
+ * Returns the active context in the specified part or <code>null</code>.
+ *
+ * @param partId
+ * @return
+ */
+ public ISelection getActiveContext(String partId);
+
+ /**
+ * Registers for post context notification. Post listeners
+ * are notified of context activation and change after all
+ * non-post listeners are notified.
+ *
+ * @param listener
+ * @since 3.3
+ */
+ public void addPostDebugContextListener(IDebugContextListener listener);
+ /**
+ * Unregisters for post context notification.
+ *
+ * @param listener
+ * @since 3.3
+ */
+ public void removePostDebugContextListener(IDebugContextListener listener);
+
+ /**
+ * Registers for post context notification in the specified part. Post listeners
+ * are notified of context activation and change after all
+ * non-post listeners are notified.
+ *
+ * @param listener
+ * @param partId
+ * @since 3.3
+ */
+ public void addPostDebugContextListener(IDebugContextListener listener, String partId);
+
+ /**
+ * Unregisters for post context notification in the specified part.
+ *
+ * @param listener
+ * @param partId
+ * @since 3.3
+ */
+ public void removePostDebugContextListener(IDebugContextListener listener, String partId);
+
+}

Back to the top