diff options
author | Darin Wright | 2006-10-16 21:13:45 +0000 |
---|---|---|
committer | Darin Wright | 2006-10-16 21:13:45 +0000 |
commit | 526b27b762f5e52f11a7e33fffbf2e51bb108be1 (patch) | |
tree | 63bb475d0668bdfbac5c89107653c0d875c86b1f | |
parent | 7ca596fe4811c5eaff3ad7bbabdb3395da730c8f (diff) | |
download | eclipse.platform.debug-526b27b762f5e52f11a7e33fffbf2e51bb108be1.tar.gz eclipse.platform.debug-526b27b762f5e52f11a7e33fffbf2e51bb108be1.tar.xz eclipse.platform.debug-526b27b762f5e52f11a7e33fffbf2e51bb108be1.zip |
merge with HEAD
70 files changed, 274 insertions, 4011 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java index abde6ef7d..964cec8bd 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java @@ -45,6 +45,14 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I public boolean isDirty(); /** + * Returns if the working copy can be written to or not (i.e. read-only in either the workspace or filesystem) + * @return if the working copy is read-only or not + * + * @since 3.3 + */ + public boolean isReadOnly(); + + /** * Saves this working copy to its underlying file and returns * a handle to the resulting launch configuration. * Has no effect if this configuration does not need saving. diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java index 96a5fa958..005b7653f 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java @@ -198,6 +198,25 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen } /** + * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#isReadOnly() + */ + public boolean isReadOnly() { + if(!isLocal()) { + IFile file = getFile(); + if(file != null) { + return file.isReadOnly(); + } + } + else { + File file = getLocation().toFile(); + if(file != null) { + return file.exists() && !file.canWrite(); + } + } + return false; + } + + /** * Writes the new configuration information to a file. * * @exception CoreException if writing the file fails diff --git a/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd b/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd index c15c46648..150cc2253 100644 --- a/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd +++ b/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd @@ -17,7 +17,7 @@ As of 3.2 the types can also define a migration delegate that can be used to set <element name="extension"> <complexType> <sequence> - <element ref="launchConfigurationType" minOccurs="0" maxOccurs="unbounded"/> + <element ref="launchConfigurationType" minOccurs="1" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> @@ -50,7 +50,7 @@ As of 3.2 the types can also define a migration delegate that can be used to set </appInfo> </annotation> <complexType> - <sequence> + <sequence minOccurs="0" maxOccurs="1"> <element ref="fileExtension" minOccurs="1" maxOccurs="unbounded"/> </sequence> <attribute name="id" type="string" use="required"> @@ -130,6 +130,11 @@ Launch configuration instances of this type will delegate to instances of this c </element> <element name="fileExtension"> + <annotation> + <appInfo> + <meta.element deprecated="true"/> + </appInfo> + </annotation> <complexType> <attribute name="extension" type="string" use="required"> <annotation> diff --git a/org.eclipse.debug.ui/.options b/org.eclipse.debug.ui/.options index d5fdd2ddb..5c01ca7a5 100644 --- a/org.eclipse.debug.ui/.options +++ b/org.eclipse.debug.ui/.options @@ -2,3 +2,4 @@ org.eclipse.debug.ui/debug = false org.eclipse.debug.ui/debug/viewers/model = false org.eclipse.debug.ui/debug/viewers/viewer = false org.eclipse.debug.ui/debug/viewers/deltas = false +org.eclipse.debug.ui/debug/commands = false diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF index ee7307ae1..683e5ba5a 100644 --- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF @@ -10,10 +10,11 @@ Export-Package: org.eclipse.debug.internal.ui;x-internal:=true, org.eclipse.debug.internal.ui.actions;x-internal:=true, org.eclipse.debug.internal.ui.actions.breakpointGroups;x-internal:=true, org.eclipse.debug.internal.ui.actions.breakpoints;x-internal:=true, - org.eclipse.debug.internal.ui.actions.context;x-internal:=true, org.eclipse.debug.internal.ui.actions.expressions;x-internal:=true, - org.eclipse.debug.internal.ui.actions.provisional;x-internal:=true, org.eclipse.debug.internal.ui.actions.variables;x-internal:=true, + org.eclipse.debug.internal.ui.commands;x-internal:=true, + org.eclipse.debug.internal.ui.commands.actions;x-internal:=true, + org.eclipse.debug.internal.ui.commands.provisional;x-internal:=true, org.eclipse.debug.internal.ui.contexts;x-internal:=true, org.eclipse.debug.internal.ui.contexts.provisional;x-internal:=true, org.eclipse.debug.internal.ui.elements.adapters;x-internal:=true, diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 5ed0073a6..b1488d345 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -174,7 +174,7 @@ <action id="org.eclipse.debug.ui.actions.ToggleStepFilters" hoverIcon="$nl$/icons/full/elcl16/stepbystep_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.ToggleStepFiltersActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.ToggleStepFiltersCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.ToggleStepFilters" disabledIcon="$nl$/icons/full/dlcl16/stepbystep_co.gif" icon="$nl$/icons/full/elcl16/stepbystep_co.gif" @@ -197,7 +197,7 @@ <action id="org.eclipse.debug.ui.actions.StepReturn" hoverIcon="$nl$/icons/full/elcl16/stepreturn_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.StepReturnActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.StepReturn" disabledIcon="$nl$/icons/full/dlcl16/stepreturn_co.gif" icon="$nl$/icons/full/elcl16/stepreturn_co.gif" @@ -208,7 +208,7 @@ <action id="org.eclipse.debug.ui.actions.StepOver" hoverIcon="$nl$/icons/full/elcl16/stepover_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.StepOverActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.StepOverCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.StepOver" disabledIcon="$nl$/icons/full/dlcl16/stepover_co.gif" icon="$nl$/icons/full/elcl16/stepover_co.gif" @@ -219,7 +219,7 @@ <action id="org.eclipse.debug.ui.actions.StepInto" hoverIcon="$nl$/icons/full/elcl16/stepinto_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.StepIntoActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.StepInto" disabledIcon="$nl$/icons/full/dlcl16/stepinto_co.gif" icon="$nl$/icons/full/elcl16/stepinto_co.gif" @@ -230,7 +230,7 @@ <action id="org.eclipse.debug.ui.actions.Terminate" hoverIcon="$nl$/icons/full/elcl16/terminate_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.TerminateActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.TerminateCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.Terminate" disabledIcon="$nl$/icons/full/dlcl16/terminate_co.gif" icon="$nl$/icons/full/elcl16/terminate_co.gif" @@ -241,7 +241,7 @@ <action id="org.eclipse.debug.ui.actions.Suspend" hoverIcon="$nl$/icons/full/elcl16/suspend_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.SuspendActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.SuspendCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.Suspend" disabledIcon="$nl$/icons/full/dlcl16/suspend_co.gif" icon="$nl$/icons/full/elcl16/suspend_co.gif" @@ -252,7 +252,7 @@ <action id="org.eclipse.debug.ui.actions.Resume" hoverIcon="$nl$/icons/full/elcl16/resume_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.ResumeActionDelegate" + class="org.eclipse.debug.internal.ui.commands.actions.ResumeCommandActionDelegate" definitionId="org.eclipse.debug.ui.commands.Resume" disabledIcon="$nl$/icons/full/dlcl16/resume_co.gif" icon="$nl$/icons/full/elcl16/resume_co.gif" @@ -553,19 +553,6 @@ label="%RemoveAllTerminatedAction.label" tooltip="%RemoveAllTerminatedAction.tooltip"> </action> - <action - id="org.eclipse.debug.ui.debugview.toolbar.toggleStepFilters" - toolbarPath="renderGroup" - hoverIcon="$nl$/icons/full/elcl16/stepbystep_co.gif" - class="org.eclipse.debug.internal.ui.actions.context.ToggleStepFiltersActionDelegate" - disabledIcon="$nl$/icons/full/dlcl16/stepbystep_co.gif" - icon="$nl$/icons/full/elcl16/stepbystep_co.gif" - label="%StepWithFiltersAction.label" - helpContextId="step_with_filters_action_context" - tooltip="%StepWithFiltersAction.tooltip" - style="toggle" - state="false"> - </action> </viewContribution> <!-- Contributions to Breakpoints View Toolbar --> @@ -985,17 +972,6 @@ menubarPath="launchGroup" id="org.eclipse.debug.ui.debugview.popupMenu.removeAllTerminated"> </action> - <action - label="%StepWithFiltersAction.label" - icon="$nl$/icons/full/elcl16/stepbystep_co.gif" - helpContextId="step_with_filters_action_context" - definitionId="org.eclipse.debug.ui.commands.ToggleStepFilters" - class="org.eclipse.debug.internal.ui.actions.context.ToggleStepFiltersActionDelegate" - menubarPath="renderGroup" - id="org.eclipse.debug.ui.debugview.popupMenu.stepWithFilters" - style="toggle" - state="false"> - </action> </viewerContribution> <!-- Contributions to Breakpoints View Popup Menu --> <viewerContribution diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index 0d72bf67a..1e574c4c7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -69,7 +69,7 @@ import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.debug.core.model.ITerminate; import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.core.model.IVariable; -import org.eclipse.debug.internal.ui.actions.context.ActionAdapterFactory; +import org.eclipse.debug.internal.ui.commands.actions.ActionAdapterFactory; import org.eclipse.debug.internal.ui.contexts.SuspendTriggerAdapterFactory; import org.eclipse.debug.internal.ui.launchConfigurations.ClosedProjectFilter; import org.eclipse.debug.internal.ui.launchConfigurations.DeletedProjectFilter; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepFilterManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepFilterManager.java index e8b8a0b03..b599e1ad4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepFilterManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepFilterManager.java @@ -13,8 +13,8 @@ package org.eclipse.debug.internal.ui; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchListener; -import org.eclipse.debug.internal.ui.actions.context.ActionRequestMonitor; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepFiltersAdapter; +import org.eclipse.debug.internal.ui.commands.actions.ActionRequestMonitor; +import org.eclipse.debug.internal.ui.commands.provisional.IStepFiltersCommand; /** * As targets are launched, this manager sets its step filter @@ -49,11 +49,9 @@ public class StepFilterManager implements ILaunchListener { * @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch) */ public void launchChanged(ILaunch launch) { - boolean useStepFilters = isUseStepFilters(); - IAsynchronousStepFiltersAdapter stepFilterAdapter = (IAsynchronousStepFiltersAdapter)launch.getAdapter(IAsynchronousStepFiltersAdapter.class); - if (stepFilterAdapter != null) - { - stepFilterAdapter.setStepFiltersEnabled(launch, useStepFilters, new ActionRequestMonitor()); + IStepFiltersCommand command = (IStepFiltersCommand)launch.getAdapter(IStepFiltersCommand.class); + if (command != null) { + command.execute(launch, new ActionRequestMonitor()); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java index a48bc3d6f..03d8aa257 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java @@ -112,6 +112,8 @@ public class ActionMessages extends NLS { public static String ToggleBreakpointAction_1; public static String ToggleBreakpointAction_2; + public static String ToggleStepFiltersAction_0; + public static String WatchExpressionDialog_0; public static String WatchExpressionDialog_1; public static String WatchExpressionDialog_2; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties index bd894fac3..15ae76a7a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties @@ -123,6 +123,8 @@ ToggleBreakpointAction_0=Toggle Brea&kpoint ToggleBreakpointAction_1=Error ToggleBreakpointAction_2=Unable to toggle breakpoint +ToggleStepFiltersAction_0=Toggle Step Filters + WatchExpressionDialog_0=Edit Watch Expression WatchExpressionDialog_1=Add Watch Expression WatchExpressionDialog_2=E&xpression: diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java index 4dca93d8c..34628b79b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java @@ -27,12 +27,9 @@ import org.eclipse.ui.IWorkbenchPart; /** * A toggle breakpoint action that can be contributed to an object. The action * will perform a toggle breakpoint operation for a selected object. - * <p> - * EXPERIMENTAL - * </p> - * <p> - * Clients may subclass this class. - * </p> + * + * <p>Clients may subclass this class.</p> + * * @since 3.0 */ public abstract class ToggleBreakpointObjectActionDelegate implements IObjectActionDelegate, IActionDelegate2 { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractDebugContextAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractDebugContextAction.java deleted file mode 100644 index dd9f6eeb4..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractDebugContextAction.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import java.util.Iterator; - -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -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.jface.action.Action; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * Provides an abstract base class for asynchronous debug actions - * - * @since 3.2 - */ -public abstract class AbstractDebugContextAction extends Action implements IDebugContextListener { - - private IStructuredSelection fActiveContext; - private IWorkbenchWindow fWindow; - private AbstractDebugContextActionDelegate fDelegate; - - /** - * Constructor - */ - public AbstractDebugContextAction() { - super(); - String helpContextId = getHelpContextId(); - if (helpContextId != null) - PlatformUI.getWorkbench().getHelpSystem().setHelp(this, helpContextId); - setEnabled(false); - } - - /** - * Set the current delegate - * @param delegate - */ - public void setDelegate(AbstractDebugContextActionDelegate 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 abstract void doAction(Object target); - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextActivated(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart) - */ - public void contextActivated(ISelection context, IWorkbenchPart part) { - fActiveContext = null; - update(context); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart) - */ - public void contextChanged(ISelection context, IWorkbenchPart part) { - contextActivated(context, part); - } - - /** - * Updates the enabled state for the current selection - * @param context the current context to evaluate enablement with - */ - protected void update(ISelection context) { - if (context instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) context; - updateEnableStateForContext(ss); - fActiveContext = (IStructuredSelection) context; - } else { - setEnabled(false); - fActiveContext = StructuredSelection.EMPTY; - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.action.Action#setEnabled(boolean) - */ - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - if (fDelegate != null) { - fDelegate.setEnabled(enabled); - } - } - - /** - * Return whether the action should be enabled or not based on the given - * selection. - * This method uses the default <code>BooleanRequestMonitor</code>, which collects - * votes, and if not cancelled, sets enablement based on the equality of the number of voters - * to the total number of voters who could have voted - */ - protected void updateEnableStateForContext(IStructuredSelection selection) { - int size = selection.size(); - BooleanRequestMonitor monitor = new BooleanRequestMonitor(this, size); - if (size > 0) { - Iterator itr = selection.iterator(); - while (itr.hasNext()) { - Object element = itr.next(); - isEnabledFor(element, monitor); - } - } else { - notSupported(monitor); - } - } - - /** - * Calls back to the <code>IBooleanRequestMonitor</code> indicating if the action - * should be enabled based on the selected element - * @param element the element to determine enablement for - * @param monitor the <code>IBooleanRequestMonitor</code> to call back to - */ - protected abstract void isEnabledFor(Object element, IBooleanRequestMonitor monitor); - - /** - * Updates the monitor with a false result. Action should call this method when - * updating enablement and the function is not supported. - * - * @param monitor - */ - protected void notSupported(IBooleanRequestMonitor monitor) { - monitor.setResult(false); - monitor.done(); - } - - /** - * Initializes the context action - * @param window the window - */ - public void init(IWorkbenchWindow window) { - setWindow(window); - IDebugContextManager manager = DebugContextManager.getDefault(); - manager.addDebugContextListener(this, window); - ISelection activeContext = manager.getActiveContext(window); - if (activeContext != null) { - contextActivated(activeContext, null); - } 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; - } - - /** - * Set the window this action is contained within - * @param window the new window - */ - protected void setWindow(IWorkbenchWindow window) { - fWindow = window; - } - - /** - * Returns the most recent selection - * - * @return structured selection - */ - protected IStructuredSelection getContext() { - return fActiveContext; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.action.Action#run() - */ - public void run() { - IStructuredSelection selection = getContext(); - if (selection != null && isEnabled()) { - // disable the action so it cannot be run again until an event or - // selection change updates the enablement - setEnabled(false); - for (Iterator iter = selection.iterator(); iter.hasNext();) { - Object element = iter.next(); - doAction(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() { - IWorkbenchWindow window = getWindow(); - if (getWindow() != null) { - DebugContextManager.getDefault().removeDebugContextListener(this, window); - } - } - - /** - * @return The current window this action is associated with - */ - protected IWorkbenchWindow getWindow() { - return fWindow; - } - - /** - * Returns the String to use as an error dialog message for a failed action. - * This message appears as the "Message:" in the error dialog for this - * action. Default is to return null. - */ - protected String getErrorDialogMessage() { - return null; - } - - /** - * Returns the String to use as a status message for a failed action. This - * message appears as the "Reason:" in the error dialog for this action. - * Default is to return the empty String. - */ - protected String getStatusMessage() { - return ""; //$NON-NLS-1$ - } - - /** - * @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/actions/context/AbstractDebugContextActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractDebugContextActionDelegate.java deleted file mode 100644 index dc672b476..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractDebugContextActionDelegate.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -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; - -public abstract class AbstractDebugContextActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2 { - - /** - *The real action for this delegate - */ - private AbstractDebugContextAction 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 AbstractDebugContextActionDelegate() { - } - - /* - * (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) { - setWindow(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 AbstractDebugContextAction getAction() { - return fDebugAction; - } - - protected void setAction(AbstractDebugContextAction action) { - fDebugAction = action; - action.setDelegate(this); - } - - protected IWorkbenchWindow getWindow() { - return fDebugAction.getWindow(); - } - - protected void setWindow(IWorkbenchWindow window) { - fDebugAction.setWindow(window); - } - - 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/actions/context/AbstractRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractRequestMonitor.java deleted file mode 100644 index 09da27eba..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/AbstractRequestMonitor.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Common function for request monitors - * - * @since 3.2 - * - */ -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/actions/context/ActionAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ActionAdapterFactory.java deleted file mode 100644 index 46a35494e..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ActionAdapterFactory.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -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.actions.provisional.IAsynchronousDisconnectAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDropToFrameAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepFiltersAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousSuspendResumeAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousTerminateAdapter; - -/** - * Adapter factory for debug capabilities. - * - * @since 3.2 - * - */ -public class ActionAdapterFactory implements IAdapterFactory { - - private static IAsynchronousDisconnectAdapter fgDisconnectAdapter = new DisconnectAdapter(); - private static IAsynchronousDropToFrameAdapter fgDropToFrameAdapter = new DropToFrameAdapter(); - private static IAsynchronousStepAdapter fgStepAdapter = new StepAdapter(); - private static IAsynchronousStepFiltersAdapter fgStepFiltersAdapter = new StepFiltersAdapter(); - private static IAsynchronousSuspendResumeAdapter fgSuspendResumeAdapter = new SuspendResumeAdapter(); - private static IAsynchronousTerminateAdapter fgTerminateAdapter = new TerminateAdapter(); - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (IAsynchronousDisconnectAdapter.class.equals(adapterType)) { - if (adaptableObject instanceof IDisconnect) { - return fgDisconnectAdapter; - } - } - if (IAsynchronousDropToFrameAdapter.class.equals(adapterType)) { - if (adaptableObject instanceof IDropToFrame) { - return fgDropToFrameAdapter; - } - } - if (IAsynchronousStepAdapter.class.equals(adapterType)) { - if (adaptableObject instanceof IStep) { - return fgStepAdapter; - } - } - if (IAsynchronousStepFiltersAdapter.class.equals(adapterType)) { - if (adaptableObject instanceof IDebugElement || - adaptableObject instanceof ILaunch || - adaptableObject instanceof IProcess) { - return fgStepFiltersAdapter; - } - } - if (IAsynchronousSuspendResumeAdapter.class.equals(adapterType)) { - if (adaptableObject instanceof ISuspendResume) { - return fgSuspendResumeAdapter; - } - } - if (IAsynchronousTerminateAdapter.class.equals(adapterType)) { - if (adaptableObject instanceof ITerminate) { - return fgTerminateAdapter; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - public Class[] getAdapterList() { - return new Class[]{IAsynchronousDisconnectAdapter.class, - IAsynchronousDropToFrameAdapter.class, - IAsynchronousStepAdapter.class, - IAsynchronousStepFiltersAdapter.class, - IAsynchronousSuspendResumeAdapter.class, - IAsynchronousTerminateAdapter.class}; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ActionRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ActionRequestMonitor.java deleted file mode 100644 index fb23d53f8..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ActionRequestMonitor.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -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.2 - * - */ -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/actions/context/BooleanOrWiseRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/BooleanOrWiseRequestMonitor.java deleted file mode 100644 index ee1403662..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/BooleanOrWiseRequestMonitor.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.action.IAction; - -/** - * Boolean Request monitor that collects votes from a number of voters. - * All participants vote, as each votes the results are or'd together, allowing - * for the pattern: if at least one of... - * - * @since 3.3 - */ -public class BooleanOrWiseRequestMonitor extends AbstractRequestMonitor implements IBooleanRequestMonitor { - - private boolean fResult = false; - private IAction fAction = null; - - /** - * Constructor - * @param action the action to set enabled state for after voting completes - */ - public BooleanOrWiseRequestMonitor(IAction action) { - fAction = action; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor#setResult(boolean) - */ - public void setResult(boolean result) { - fResult |= result; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IProgressMonitor#done() - */ - public void done() { - if(fAction != null) { - fAction.setEnabled(fResult); - } - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/BooleanRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/BooleanRequestMonitor.java deleted file mode 100644 index 4823ed59e..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/BooleanRequestMonitor.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.debug.internal.ui.actions.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.2 - * - */ -public class BooleanRequestMonitor extends AbstractRequestMonitor implements IBooleanRequestMonitor { - - private IAction fAction; - private int fNumVoters; - private int fNumOfVotes = 0; - - 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/actions/context/DisconnectAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectAction.java deleted file mode 100644 index 29b7174d0..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectAction.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousDisconnectAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.resource.ImageDescriptor; - -public class DisconnectAction extends AbstractDebugContextAction { - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousDisconnectAdapter disconnect = (IAsynchronousDisconnectAdapter) adaptable.getAdapter(IAsynchronousDisconnectAdapter.class); - if (disconnect != null) - disconnect.disconnect(element, new ActionRequestMonitor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousDisconnectAdapter disconnect = (IAsynchronousDisconnectAdapter) adaptable.getAdapter(IAsynchronousDisconnectAdapter.class); - if (disconnect != null) { - disconnect.canDisconnect(element, monitor); - } else { - notSupported(monitor); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getStatusMessage() - */ - protected String getStatusMessage() { - return ActionMessages.DisconnectActionDelegate_Exceptions_occurred_attempting_to_disconnect__2; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getErrorDialogMessage() - */ - protected String getErrorDialogMessage() { - return ActionMessages.DisconnectActionDelegate_Disconnect_failed_1; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText() - */ - public String getText() { - return ActionMessages.DisconnectAction_0; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId() - */ - public String getHelpContextId() { - return "disconnect_action_context"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.toolbar.disconnect"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.DisconnectAction_3; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectActionDelegate.java deleted file mode 100644 index 088d9ddde..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectActionDelegate.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class DisconnectActionDelegate extends AbstractDebugContextActionDelegate { - public DisconnectActionDelegate() { - super(); - setAction(new DisconnectAction()); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectAdapter.java deleted file mode 100644 index 5ea371e3b..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DisconnectAdapter.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDisconnect; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDisconnectAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Default disconnect adapter for standard debug model. - * - * @since 3.2 - */ -public class DisconnectAdapter extends StandardActionAdapter implements IAsynchronousDisconnectAdapter { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDisconnectAdapter#canDisconnect(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void canDisconnect(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("canDisconnect") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IDisconnect disconnect = getTarget(element); - if (disconnect != null) - requestMonitor.setResult(disconnect.canDisconnect()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDisconnectAdapter#isDisconnected(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void isDisconnected(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("isDisconnected") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IDisconnect disconnect = getTarget(element); - if (disconnect != null) { - requestMonitor.setResult(disconnect.isDisconnected()); - } else { - requestMonitor.setResult(false); - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDisconnectAdapter#disconnect(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) - */ - public void disconnect(final Object element, final IAsynchronousRequestMonitor requestMonitor) { - Job job = new Job("isDisconnected") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IDisconnect disconnect = getTarget(element); - - if (disconnect == null) { - requestMonitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to IDisconnect", //$NON-NLS-1$ - null)); - } else { - try { - disconnect.disconnect(); - } catch (DebugException e) { - requestMonitor.setStatus(e.getStatus()); - } - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - private IDisconnect getTarget(Object element) { - if (element instanceof IDisconnect) { - return (IDisconnect) element; - } else if (element instanceof IAdaptable) { - return (IDisconnect) ((IAdaptable) element).getAdapter(IDisconnect.class); - } - return null; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameAction.java deleted file mode 100644 index 62ec99a20..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameAction.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousDropToFrameAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Action delegate which performs a drop to frame. - */ -public class DropToFrameAction extends AbstractDebugContextAction { - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousDropToFrameAdapter dropper = (IAsynchronousDropToFrameAdapter) adaptable.getAdapter(IAsynchronousDropToFrameAdapter.class); - if (dropper != null) - dropper.dropToFrame(element, new ActionRequestMonitor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousDropToFrameAdapter dropper = (IAsynchronousDropToFrameAdapter) adaptable.getAdapter(IAsynchronousDropToFrameAdapter.class); - if (dropper != null) { - dropper.canDropToFrame(element, monitor); - } else { - notSupported(monitor); - } - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText() - */ - public String getText() { - return ActionMessages.DropToFrameAction_0; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId() - */ - public String getHelpContextId() { - return "drop_to_frame_action_context"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.toolbar.dropToFrame"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.DropToFrameAction_3; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return null; - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameActionDelegate.java deleted file mode 100644 index 974fbf921..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameActionDelegate.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class DropToFrameActionDelegate extends AbstractDebugContextActionDelegate { - public DropToFrameActionDelegate() { - super(); - setAction(new DropToFrameAction()); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameAdapter.java deleted file mode 100644 index 69fdded8f..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/DropToFrameAdapter.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDropToFrame; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousDropToFrameAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class DropToFrameAdapter extends StandardActionAdapter implements IAsynchronousDropToFrameAdapter { - - public void canDropToFrame(final Object element, final IBooleanRequestMonitor monitor) { - Job job = new Job("canDropToFrame") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - IDropToFrame dropToFrame = getTarget(element); - if (dropToFrame != null) { - monitor.setResult(dropToFrame.canDropToFrame()); - } else { - monitor.setResult(false); - } - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - public void dropToFrame(final Object element, final IAsynchronousRequestMonitor monitor) { - Job job = new Job("dropToFrame") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - IDropToFrame dropToFrame = getTarget(element); - if (dropToFrame != null) { - try { - dropToFrame.dropToFrame(); - } catch (DebugException e) { - monitor.setStatus(e.getStatus()); - } - } else { - monitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to IDropToFrame", //$NON-NLS-1$ - null)); - } - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - private IDropToFrame getTarget(Object element) { - if (element instanceof IDropToFrame) { - return (IDropToFrame) element; - } else if (element instanceof IAdaptable) { - return (IDropToFrame) ((IAdaptable) element).getAdapter(IDropToFrame.class); - } - return null; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ResumeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ResumeAction.java deleted file mode 100644 index 9477b72c1..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ResumeAction.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IThread; -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.actions.provisional.IAsynchronousSuspendResumeAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class ResumeAction extends AbstractDebugContextAction { - - public ResumeAction() { - setActionDefinitionId("org.eclipse.debug.ui.commands.Resume"); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousSuspendResumeAdapter suspendResumer = (IAsynchronousSuspendResumeAdapter) adaptable.getAdapter(IAsynchronousSuspendResumeAdapter.class); - if (suspendResumer != null) - suspendResumer.resume(element, new ActionRequestMonitor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousSuspendResumeAdapter suspendResumer = (IAsynchronousSuspendResumeAdapter) adaptable.getAdapter(IAsynchronousSuspendResumeAdapter.class); - if (suspendResumer != null) { - suspendResumer.canResume(element, monitor); - } else { - notSupported(monitor); - } - } - } - - - /** - * Resumes all threads in the target associated with the given element - * - * @param object - * debug element - * @throws DebugException - * on failure - */ - protected void doActionForAllThreads(Object object) throws DebugException { - if (isEnabledForAllThreads(object)) { - IDebugElement debugElement = (IDebugElement) object; - IThread[] threads = debugElement.getDebugTarget().getThreads(); - for (int i = 0; i < threads.length; i++) { - IThread thread = threads[i]; - if (thread.canResume()) { - thread.resume(); - } - } - } - } - - /** - * Returns whether 'resume all threads' should be enabled for the given - * element. - */ - protected boolean isEnabledForAllThreads(Object element) { - if (element instanceof IDebugElement) { - IDebugElement debugElement = (IDebugElement) element; - try { - IThread[] threads = debugElement.getDebugTarget().getThreads(); - for (int i = 0; i < threads.length; i++) { - if (threads[i].canResume()) { - return true; - } - } - } catch (DebugException e) { - } - } - return false; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getStatusMessage() - */ - protected String getStatusMessage() { - return ActionMessages.ResumeActionDelegate_Exceptions_occurred_attempting_to_resume__2; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getErrorDialogMessage() - */ - protected String getErrorDialogMessage() { - return ActionMessages.ResumeActionDelegate_Resume_failed__1; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText() - */ - public String getText() { - return ActionMessages.ResumeAction_0; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId() - */ - public String getHelpContextId() { - return "resume_action_context"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.toolbar.resume"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.ResumeAction_3; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESUME); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ResumeActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ResumeActionDelegate.java deleted file mode 100644 index 447ede46e..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ResumeActionDelegate.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class ResumeActionDelegate extends AbstractDebugContextActionDelegate { - public ResumeActionDelegate() { - super(); - setAction(new ResumeAction()); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StandardActionAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StandardActionAdapter.java deleted file mode 100644 index 19dc6d5f7..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StandardActionAdapter.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.debug.internal.ui.viewers.AsynchronousSchedulingRuleFactory; - -/** - * Common function for standard debug action adapter implemetnations. - * - * @since 3.2 - * - */ -public class StandardActionAdapter { - - /** - * Scheduling rule for updating action enablement. - * - * @return scheduling rule or <code>null</code> - */ - protected ISchedulingRule createUpdateSchedulingRule() { - return AsynchronousSchedulingRuleFactory.getDefault().newSerialRule(); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepAction.java deleted file mode 100644 index fe8d52f88..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepAction.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * 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 - * Pawel Piech - bug 134177 - *******************************************************************************/ - -package org.eclipse.debug.internal.ui.actions.context; - -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; - -public abstract class StepAction extends AbstractDebugContextAction { - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(Object object) { - stepAction(object); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - checkCapability(element, monitor); - } - - - protected abstract void checkCapability(Object element, IBooleanRequestMonitor monitor); - /** - * Performs the specific step action. - * - * @exception DebugException if the action fails - */ - protected abstract void stepAction(Object element); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepAdapter.java deleted file mode 100644 index 2c049c2b7..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepAdapter.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IStep; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Default step adapter for standard debug model. - * - * @since 3.2 - */ -public class StepAdapter extends StandardActionAdapter implements IAsynchronousStepAdapter { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#canStepInto(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void canStepInto(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("canStepInto") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) - requestMonitor.setResult(step.canStepInto()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#canStepOver(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void canStepOver(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("canStepOver") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) - requestMonitor.setResult(step.canStepOver()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#canStepReturn(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void canStepReturn(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("canStepReturn") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) - requestMonitor.setResult(step.canStepReturn()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#isStepping(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void isStepping(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("isStepping") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) - requestMonitor.setResult(step.isStepping()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#stepInto(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) - */ - public void stepInto(final Object element, final IAsynchronousRequestMonitor requestMonitor) { - Job job = new Job("stepInto") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) { - try { - step.stepInto(); - } catch (DebugException e) { - requestMonitor.setStatus(e.getStatus()); - } - } else { - requestMonitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to IStep", //$NON-NLS-1$ - null)); - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#stepOver(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) - */ - public void stepOver(final Object element, final IAsynchronousRequestMonitor requestMonitor) { - Job job = new Job("stepOver") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) { - try { - step.stepOver(); - } catch (DebugException e) { - requestMonitor.setStatus(e.getStatus()); - } - } else { - requestMonitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to IStep", //$NON-NLS-1$ - null)); - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepAdapter#stepReturn(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) - */ - public void stepReturn(final Object element, final IAsynchronousRequestMonitor requestMonitor) { - Job job = new Job("stepReturn") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IStep step = getTarget(element); - if (step != null) { - try { - step.stepReturn(); - } catch (DebugException e) { - requestMonitor.setStatus(e.getStatus()); - } - } else { - requestMonitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to IStep", //$NON-NLS-1$ - null)); - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - - } - - private IStep getTarget(Object element) { - if (element instanceof IStep) { - return (IStep) element; - } else if (element instanceof IAdaptable) { - return (IStep) ((IAdaptable) element).getAdapter(IStep.class); - } - return null; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepFiltersAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepFiltersAdapter.java deleted file mode 100644 index 9012ab04d..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepFiltersAdapter.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -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.actions.provisional.IAsynchronousStepFiltersAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Default step filters adapter for standard debug model. - * - * @since 3.2 - */ -public class StepFiltersAdapter extends StandardActionAdapter implements IAsynchronousStepFiltersAdapter { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepFiltersAdapter#supportsStepFilters(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void supportsStepFilters(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("supportsStepFilters") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - boolean supported = false; - IDebugTarget[] debugTargets = getDebugTargets(element); - for (int i=0; i<debugTargets.length; i++) - { - IStepFilters filters = getTarget(debugTargets[i]); - - if (filters != null) - { - if (filters.supportsStepFilters()) - supported = true; - } - - // only one needs to support it - if (supported) - break; - - } - - requestMonitor.setResult(supported); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepFiltersAdapter#isStepFiltersEnabled(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void isStepFiltersEnabled(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("isStepFiltersEnabled") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - IDebugTarget[] debugTargets = getDebugTargets(element); - - for (int i=0; i<debugTargets.length; i++) - { - IStepFilters filters = getTarget(element); - - if (filters != null) - requestMonitor.setResult(filters.isStepFiltersEnabled()); - else - { - requestMonitor.setResult(false); - } - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepFiltersAdapter#setStepFiltersEnabled(java.lang.Object, boolean, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) - */ - public void setStepFiltersEnabled(final Object element, final boolean enabled, final IAsynchronousRequestMonitor requestMonitor) { - Job job = new Job("setStepFiltersEnabled") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - - IDebugTarget[] debugTargets = getDebugTargets(element); - for (int i=0; i<debugTargets.length; i++) - { - IStepFilters filters = getTarget(debugTargets[i]); - - if (filters != null && filters.isStepFiltersEnabled() != enabled) - filters.setStepFiltersEnabled(enabled); - - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - private IStepFilters getTarget(Object element) - { - if (element instanceof IStepFilters) { - return (IStepFilters) element; - } else if (element instanceof IAdaptable) { - return (IStepFilters) ((IAdaptable)element).getAdapter(IStepFilters.class); - } - return null; - } - - 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/actions/context/StepIntoAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepIntoAction.java deleted file mode 100644 index d34a62482..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepIntoAction.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * 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 - * Pawel Piech - bug 134177 - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousStepAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class StepIntoAction extends StepAction { - - public StepIntoAction() { - setActionDefinitionId("org.eclipse.debug.ui.commands.StepInto"); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepAction#checkCapability(org.eclipse.debug.core.model.IStep, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void checkCapability(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class); - if (steppy != null) { - steppy.canStepInto(element, monitor); - } else { - notSupported(monitor); - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepAction#stepAction(org.eclipse.debug.core.model.IStep) - */ - protected void stepAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class); - if (steppy != null) - steppy.stepInto(element, new ActionRequestMonitor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getStatusMessage() - */ - protected String getStatusMessage() { - return ActionMessages.StepIntoActionDelegate_Exceptions_occurred_attempting_to_step_into_the_frame_2; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getErrorDialogMessage() - */ - protected String getErrorDialogMessage() { - return ActionMessages.StepIntoActionDelegate_Step_into_failed_1; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText() - */ - public String getText() { - return ActionMessages.StepIntoAction_0; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId() - */ - public String getHelpContextId() { - return "step_into_action_context"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.toolbar.stepInto"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.StepIntoAction_3; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_INTO); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepIntoActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepIntoActionDelegate.java deleted file mode 100644 index 95c27173a..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepIntoActionDelegate.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class StepIntoActionDelegate extends AbstractDebugContextActionDelegate { - - public StepIntoActionDelegate() { - super(); - setAction(new StepIntoAction()); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepOverAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepOverAction.java deleted file mode 100644 index 8085a5958..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepOverAction.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * 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 - * Pawel Piech - bug 134177 - *******************************************************************************/ - -package org.eclipse.debug.internal.ui.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousStepAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class StepOverAction extends StepIntoAction { - - public StepOverAction() { - setActionDefinitionId("org.eclipse.debug.ui.commands.StepOver"); //$NON-NLS-1$ - } - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getText() - */ - public String getText() { - return ActionMessages.StepOverAction_0; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_OVER); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getHelpContextId() - */ - public String getHelpContextId() { - return "step_over_action_context"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.toolbar.stepOver"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.StepOverAction_3; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#checkCapability(org.eclipse.debug.core.model.IStep, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void checkCapability(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class); - if (steppy != null) { - steppy.canStepOver(element, monitor); - } else { - notSupported(monitor); - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#stepAction(org.eclipse.debug.core.model.IStep) - */ - protected void stepAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class); - if (steppy != null) - steppy.stepOver(element, new ActionRequestMonitor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getStatusMessage() - */ - protected String getStatusMessage() { - return ActionMessages.StepOverActionDelegate_Exceptions_occurred_attempting_to_step_over_the_frame_2; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.StepIntoAction#getErrorDialogMessage() - */ - protected String getErrorDialogMessage() { - return ActionMessages.StepOverActionDelegate_Step_over_failed_1; - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepOverActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepOverActionDelegate.java deleted file mode 100644 index e32fba34d..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepOverActionDelegate.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class StepOverActionDelegate extends AbstractDebugContextActionDelegate { - public StepOverActionDelegate() { - super(); - setAction(new StepOverAction()); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepReturnAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepReturnAction.java deleted file mode 100644 index 0321b8301..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepReturnAction.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * 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 - * Pawel Piech - bug 134177 - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousStepAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class StepReturnAction extends StepIntoAction { - - - public StepReturnAction() { - 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 void checkCapability(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class); - if (steppy != null) { - steppy.canStepReturn(element, monitor); - } else { - notSupported(monitor); - } - } - } - - protected void stepAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousStepAdapter steppy = (IAsynchronousStepAdapter) adaptable.getAdapter(IAsynchronousStepAdapter.class); - if (steppy != null) - steppy.stepReturn(element, new ActionRequestMonitor()); - } - } - - protected String getStatusMessage() { - return ActionMessages.StepReturnActionDelegate_Exceptions_occurred_attempting_to_run_to_return_of_the_frame__2; - } - - protected String getErrorDialogMessage() { - return ActionMessages.StepReturnActionDelegate_Run_to_return_failed__1; - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepReturnActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepReturnActionDelegate.java deleted file mode 100644 index 8fb617538..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/StepReturnActionDelegate.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class StepReturnActionDelegate extends AbstractDebugContextActionDelegate { - - public StepReturnActionDelegate() { - super(); - setAction(new StepReturnAction()); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendAction.java deleted file mode 100644 index cf21c6db0..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendAction.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousSuspendResumeAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class SuspendAction extends AbstractDebugContextAction { - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(Object element) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousSuspendResumeAdapter suspendResumer = (IAsynchronousSuspendResumeAdapter) adaptable.getAdapter(IAsynchronousSuspendResumeAdapter.class); - if (suspendResumer != null) - suspendResumer.suspend(element, new ActionRequestMonitor()); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable) element; - IAsynchronousSuspendResumeAdapter suspendResumer = (IAsynchronousSuspendResumeAdapter) adaptable.getAdapter(IAsynchronousSuspendResumeAdapter.class); - if (suspendResumer != null) { - suspendResumer.canSuspend(element, monitor); - } else { - notSupported(monitor); - } - } - - } - - - protected String getStatusMessage() { - return ActionMessages.SuspendActionDelegate_Exceptions_occurred_attempting_to_suspend__2; - } - - protected String getErrorDialogMessage() { - return ActionMessages.SuspendActionDelegate_Suspend_failed_1; - } - - 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); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendActionDelegate.java deleted file mode 100644 index 6d194cb48..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendActionDelegate.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class SuspendActionDelegate extends AbstractDebugContextActionDelegate { - - public SuspendActionDelegate() { - super(); - setAction(new SuspendAction()); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendResumeAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendResumeAdapter.java deleted file mode 100644 index 97a124493..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/SuspendResumeAdapter.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.ISuspendResume; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousSuspendResumeAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; -import org.eclipse.debug.ui.IDebugUIConstants; - -public class SuspendResumeAdapter extends StandardActionAdapter implements IAsynchronousSuspendResumeAdapter { - - public void canResume(final Object element, final IBooleanRequestMonitor monitor) { - Job job = new Job("canResume") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - ISuspendResume suspendResume = getTarget(element); - if (suspendResume != null) - monitor.setResult(suspendResume.canResume()); - else - monitor.setResult(false); - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - public void canSuspend(final Object element, final IBooleanRequestMonitor monitor) { - Job job = new Job("canSuspend") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - ISuspendResume suspendResume = getTarget(element); - if (suspendResume != null) - monitor.setResult(suspendResume.canSuspend()); - else - monitor.setResult(false); - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - public void isSuspended(final Object element, final IBooleanRequestMonitor monitor) { - Job job = new Job("isSuspended") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - ISuspendResume suspendResume = getTarget(element); - if (suspendResume != null) - monitor.setResult(suspendResume.isSuspended()); - else - monitor.setResult(false); - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - public void resume(final Object element, final IAsynchronousRequestMonitor monitor) { - Job job = new Job("resume") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - ISuspendResume suspendResume = getTarget(element); - if (suspendResume != null) { - try { - suspendResume.resume(); - } catch (DebugException e) { - monitor.setStatus(e.getStatus()); - } - } else { - monitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to ISuspendResume", //$NON-NLS-1$ - null)); - } - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - public void suspend(final Object element, final IAsynchronousRequestMonitor monitor) { - Job job = new Job("suspend") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor pm) { - if (!pm.isCanceled()) { - ISuspendResume suspendResume = getTarget(element); - if (suspendResume != null) { - try { - suspendResume.suspend(); - } catch (DebugException e) { - monitor.setStatus(e.getStatus()); - } - } else { - monitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to ISuspendResume", //$NON-NLS-1$ - null)); - } - monitor.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - private ISuspendResume getTarget(Object element) { - if (element instanceof ISuspendResume) { - return (ISuspendResume) element; - } else if (element instanceof IAdaptable) { - return (ISuspendResume) ((IAdaptable) element).getAdapter(ISuspendResume.class); - } - return null; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAction.java deleted file mode 100644 index 092712a48..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAction.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousTerminateAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class TerminateAction extends AbstractDebugContextAction { - - public TerminateAction() { - setActionDefinitionId("org.eclipse.debug.ui.commands.Terminate"); //$NON-NLS-1$ - } - - protected void doAction(final Object element) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable)element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) - adapter.terminate(element, new ActionRequestMonitor()); - } - } - - - - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable)element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) { - adapter.canTerminate(element, monitor); - } else { - notSupported(monitor); - } - } - } - - protected String getStatusMessage() { - return ActionMessages.TerminateActionDelegate_Exceptions_occurred_attempting_to_terminate__2; - } - - protected String getErrorDialogMessage() { - return ActionMessages.TerminateActionDelegate_Terminate_failed__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); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateActionDelegate.java deleted file mode 100644 index b077b59a1..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateActionDelegate.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class TerminateActionDelegate extends AbstractDebugContextActionDelegate { - - public TerminateActionDelegate() { - super(); - setAction(new TerminateAction()); - } - - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAdapter.java deleted file mode 100644 index cae76e711..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAdapter.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.ITerminate; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousTerminateAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Default terminate adapter for standard debug model. - * - * @since 3.2 - */ -public class TerminateAdapter extends StandardActionAdapter implements IAsynchronousTerminateAdapter { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousTerminateAdapter#canTerminate(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void canTerminate(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("canTerminate") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - ITerminate terminate = getTarget(element); - if (terminate != null) - requestMonitor.setResult(terminate.canTerminate()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousTerminateAdapter#isTerminated(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - public void isTerminated(final Object element, final IBooleanRequestMonitor requestMonitor) { - Job job = new Job("isTerminated") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - ITerminate terminate = getTarget(element); - if (terminate != null) - requestMonitor.setResult(terminate.isTerminated()); - else - requestMonitor.setResult(false); - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.setRule(createUpdateSchedulingRule()); - job.schedule(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousTerminateAdapter#terminate(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor) - */ - public void terminate(final Object element, final IAsynchronousRequestMonitor requestMonitor) { - Job job = new Job("terminate") { //$NON-NLS-1$ - protected IStatus run(IProgressMonitor monitor) { - ITerminate terminate = getTarget(element); - if (terminate != null) { - try { - if (element instanceof IProcess) { - killTargets((IProcess) element); - } - ((ITerminate) element).terminate(); - } catch (DebugException e) { - requestMonitor.setStatus(e.getStatus()); - } - } else { - requestMonitor.setStatus(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "element must be an instance of or adapt to ITerminate", //$NON-NLS-1$ - null)); - } - requestMonitor.done(); - return Status.OK_STATUS; - } - }; - job.setSystem(true); - job.schedule(); - } - - private void killTargets(IProcess process) throws DebugException { - ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); - ILaunch[] launches = launchManager.getLaunches(); - - for (int i = 0; i < launches.length; i++) { - ILaunch launch = launches[i]; - IProcess[] processes = launch.getProcesses(); - for (int j = 0; j < processes.length; j++) { - IProcess process2 = processes[j]; - if (process2.equals(process)) { - IDebugTarget[] debugTargets = launch.getDebugTargets(); - for (int k = 0; k < debugTargets.length; k++) { - IDebugTarget target = debugTargets[k]; - if (target.canTerminate()) { - target.terminate(); - } - } - return; // all possible targets have been terminated for the - // launch. - } - } - } - } - - private ITerminate getTarget(Object element) { - if (element instanceof ITerminate) { - return (ITerminate) element; - } else if (element instanceof IAdaptable) { - return (ITerminate) ((IAdaptable) element).getAdapter(ITerminate.class); - } - return null; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAllAction.java deleted file mode 100644 index cb590cc35..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAllAction.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugPlugin; -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.actions.provisional.IAsynchronousTerminateAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; - -/** - * Terminates all launches. - */ -public class TerminateAllAction extends AbstractDebugContextAction { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(final Object element) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable) element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) - adapter.terminate(element, new ActionRequestMonitor()); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable) element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) { - adapter.canTerminate(element, monitor); - } else { - notSupported(monitor); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#updateEnableStateForContext(org.eclipse.jface.viewers.IStructuredSelection) - */ - protected void updateEnableStateForContext(IStructuredSelection selection) { - BooleanOrWiseRequestMonitor monitor = new BooleanOrWiseRequestMonitor(this); - if(selection.size() > 0) { - Iterator itr = selection.iterator(); - while (itr.hasNext()) { - Object element = itr.next(); - isEnabledFor(element, monitor); - } - } else { - notSupported(monitor); - } - } - - /** - * Update the action enablement based on the launches present in the launch - * manager. - */ - protected void update(ISelection selection) { - super.update(getContext()); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getContext() - */ - protected IStructuredSelection getContext() { - return new StructuredSelection(DebugPlugin.getDefault() - .getLaunchManager().getLaunches()); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId() - */ - public String getHelpContextId() { - return "terminate_all_action_context"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.popupMenu.terminateAll"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText() - */ - public String getText() { - return ActionMessages.TerminateAllAction_2; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.TerminateAllAction_3; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return DebugPluginImages - .getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_ALL); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages - .getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_ALL); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return DebugPluginImages - .getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_ALL); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRelaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRelaunchAction.java deleted file mode 100644 index 2bae2f2c0..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRelaunchAction.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.ITerminate; -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.actions.provisional.IAsynchronousTerminateAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Action which terminates a launch and then re-launches it. - */ -public class TerminateAndRelaunchAction extends AbstractDebugContextAction { - - 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()); - } - }); - } - - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#doAction(java.lang.Object) - */ - protected void doAction(Object element) { - ILaunch launch = RelaunchActionDelegate.getLaunch(element); - if (launch == null || !(element instanceof ITerminate)) { - // Shouldn't happen because of enablement check. - return; - } - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable)element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) - adapter.terminate(element, new RequestMonitor(launch)); - } - } - - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#isEnabledFor(java.lang.Object, org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor) - */ - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable)element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) { - ILaunch launch = RelaunchActionDelegate.getLaunch(element); - if(launch != null && LaunchConfigurationManager.isVisible(launch.getLaunchConfiguration())) { - adapter.canTerminate(element, monitor); - return; - } - } - } - notSupported(monitor); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.Action#getActionDefinitionId() - */ - public String getActionDefinitionId() { - return ActionMessages.TerminateAndRelaunchAction_0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHelpContextId() - */ - public String getHelpContextId() { - return "terminate_and_relaunch_action_context"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getId() - */ - public String getId() { - return "org.eclipse.debug.ui.debugview.popupMenu.TerminateAndRelaunch"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getText() - */ - public String getText() { - return ActionMessages.TerminateAndRelaunchAction_3; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getToolTipText() - */ - public String getToolTipText() { - return ActionMessages.TerminateAndRelaunchAction_4; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getDisabledImageDescriptor() - */ - public ImageDescriptor getDisabledImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_RELAUNCH); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getHoverImageDescriptor() - */ - public ImageDescriptor getHoverImageDescriptor() { - return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getImageDescriptor() - */ - 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/actions/context/TerminateAndRemoveAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRemoveAction.java deleted file mode 100644 index 25ee97983..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRemoveAction.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.core.runtime.IAdaptable; -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.actions.provisional.IAsynchronousTerminateAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; - -public class TerminateAndRemoveAction extends AbstractDebugContextAction { - - - class TerminateAndRemoveMonitor extends ActionRequestMonitor { - private Object fElement; - TerminateAndRemoveMonitor(Object element) { - fElement = element; - } - public void done() { - if(getStatus() == null) { - 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(); - } - - } - protected void doAction(Object element) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable)element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) - adapter.terminate(element, new TerminateAndRemoveMonitor(element)); - } - } - - - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) { - IAsynchronousTerminateAdapter adapter = (IAsynchronousTerminateAdapter) ((IAdaptable)element).getAdapter(IAsynchronousTerminateAdapter.class); - if (adapter != null) { - adapter.canTerminate(element, monitor); - } else { - notSupported(monitor); - } - } - - } - - protected String getStatusMessage() { - return ActionMessages.TerminateAndRemoveActionDelegate_Exceptions_occurred_attempting_to_terminate_and_remove_2; - } - - protected String getErrorDialogMessage() { - return ActionMessages.TerminateAndRemoveActionDelegate_Terminate_and_remove_failed_1; - } - - 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); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRemoveActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRemoveActionDelegate.java deleted file mode 100644 index 99509b9ac..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/TerminateAndRemoveActionDelegate.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -public class TerminateAndRemoveActionDelegate extends AbstractDebugContextActionDelegate { - - public TerminateAndRemoveActionDelegate() { - super(); - setAction(new TerminateAndRemoveAction()); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ToggleStepFiltersAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ToggleStepFiltersAction.java deleted file mode 100644 index ba9eeb3b1..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ToggleStepFiltersAction.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.internal.ui.DebugPluginImages; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.actions.provisional.IAsynchronousStepFiltersAdapter; -import org.eclipse.debug.internal.ui.actions.provisional.IBooleanRequestMonitor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; - -public class ToggleStepFiltersAction extends AbstractDebugContextAction { - - public ToggleStepFiltersAction() - { - super(); - setEnabled(true); - } - - protected void doAction(Object target) { - // do nothing, the action is done by ToggleStepFiltersActionDelegate instead - // since this action does not have access to the checked state of the window button - } - - 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() { - // TODO: this #getText method is not currently used, putting non-nl string - // until properties files are opened to be updated again. - return "Toggle Step Filters"; //$NON-NLS-1$ - } - - public String getToolTipText() { - // TODO: this #getToolTipText method is not currently used, putting non-nl string - // until properties files are opened to be updated again. - return "Toggle Step Filters"; //$NON-NLS-1$ - } - - protected void isEnabledFor(Object element, IBooleanRequestMonitor monitor) { - if (element instanceof IAdaptable) - { - IAsynchronousStepFiltersAdapter stepFilters = (IAsynchronousStepFiltersAdapter)((IAdaptable)element).getAdapter(IAsynchronousStepFiltersAdapter.class); - if (stepFilters != null) - { - stepFilters.supportsStepFilters(element, monitor); - } - else - { - notSupported(monitor); - } - } - - } - - protected void updateEnableStateForContext(IStructuredSelection selection) { - - int size = selection.size(); - if (size == 1) - { - BooleanRequestMonitor monitor = new BooleanRequestMonitor(this, size); - - Iterator itr = selection.iterator(); - while (itr.hasNext()) { - Object element = itr.next(); - isEnabledFor(element, monitor); - } - } - else - { - BooleanRequestMonitor monitor = new BooleanRequestMonitor(this, 1); - monitor.setResult(true); - monitor.done(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction#getInitialEnablement() - */ - protected boolean getInitialEnablement() { - return true; - } - - - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ToggleStepFiltersActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ToggleStepFiltersActionDelegate.java deleted file mode 100644 index 409b450be..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/context/ToggleStepFiltersActionDelegate.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * 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.actions.context; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -/** - * Turns step filters on/off for a selected target. - */ -public class ToggleStepFiltersActionDelegate extends AbstractDebugContextActionDelegate implements IPropertyChangeListener, IViewActionDelegate { - - - public ToggleStepFiltersActionDelegate() { - setAction(new ToggleStepFiltersAction()); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) - */ - public void init(IAction action) { - super.init(action); - getWindowAction().setChecked(isUseStepFilters()); - getPreferenceStore().addPropertyChangeListener(this); - } - - private boolean isUseStepFilters() { - return DebugUIPlugin.getDefault().getStepFilterManager().isUseStepFilters(); - } - - private IPreferenceStore getPreferenceStore() { - return DebugUIPlugin.getDefault().getPreferenceStore(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(IInternalDebugUIConstants.PREF_USE_STEP_FILTERS)) { - Object newValue = event.getNewValue(); - if (newValue instanceof Boolean) { - getWindowAction().setChecked(((Boolean)(newValue)).booleanValue()); - } else if (newValue instanceof String) { - getWindowAction().setChecked(Boolean.valueOf((String)newValue).booleanValue()); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() - */ - public void dispose() { - getPreferenceStore().removePropertyChangeListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - //this is to ensure that when the toolbar is initialized and run() gets called for checked items we don't immediately - //reverse our desired check state. - if(action instanceof Action) { - if(action.isChecked() != isUseStepFilters()) { - DebugUITools.setUseStepFilters(!isUseStepFilters()); - } - } - else { - DebugUITools.setUseStepFilters(!isUseStepFilters()); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - init(view.getSite().getWorkbenchWindow()); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousDisconnectAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousDisconnectAdapter.java deleted file mode 100644 index bb603ca4e..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousDisconnectAdapter.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Adapter for disconnecting. - * - * @since 3.2 - */ -public interface IAsynchronousDisconnectAdapter { - - /** - * Asynchronously determines whether the given element can be disconnected. - * - * @param element element - * @param monitor request monitor - */ - public void canDisconnect(Object element, IBooleanRequestMonitor monitor); - - /** - * Asynchronously determines whether the given element is disconnected. - * - * @param element element - * @param monitor request monitor - */ - public void isDisconnected(Object element, IBooleanRequestMonitor monitor); - - /** - * Asynchronously disconnects the given element. - * - * @param element element - * @param monitor request monitor - */ - public void disconnect(Object element, IAsynchronousRequestMonitor monitor); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousDropToFrameAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousDropToFrameAdapter.java deleted file mode 100644 index 513c18ab4..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousDropToFrameAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Adapter for performing a drop to frame. - * - * @since 3.2 - */ -public interface IAsynchronousDropToFrameAdapter { - - /** - * Asynchronously determines whether the given element can perform a drop to frame. - * - * @param element element - * @param monitor request monitor - */ - public void canDropToFrame(Object element, IBooleanRequestMonitor monitor); - - /** - * Asynchronously drops to the given frame. - * - * @param element element - * @param monitor request monitor - */ - public void dropToFrame(Object element, IAsynchronousRequestMonitor monitor); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousStepAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousStepAdapter.java deleted file mode 100644 index 129c1d018..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousStepAdapter.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Adapter for stepping. - * - * @since 3.2 - */ -public interface IAsynchronousStepAdapter { - - /** - * Asynchronously determines whether the given element can perform a step into. - * - * @param element element - * @param monitor request monitor - */ - public void canStepInto(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously determines whether the given element can perform a step over. - * - * @param element element - * @param monitor request monitor - */ - public void canStepOver(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously determines whether the given element can perform a step return. - * - * @param element element - * @param monitor request monitor - */ - public void canStepReturn(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously determines whether the given element is stepping. - * - * @param element element - * @param monitor request monitor - */ - public void isStepping(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously performs a step into. - * - * @param element element - * @param monitor request monitor - */ - public void stepInto(Object element, IAsynchronousRequestMonitor monitor); - /** - * Asynchronously performs a step over. - * - * @param element element - * @param monitor request monitor - */ - public void stepOver(Object element, IAsynchronousRequestMonitor monitor); - /** - * Asynchronously performs a step return. - * - * @param element element - * @param monitor request monitor - */ - public void stepReturn(Object element, IAsynchronousRequestMonitor monitor); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousStepFiltersAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousStepFiltersAdapter.java deleted file mode 100644 index 410b5306f..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousStepFiltersAdapter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Adapter for enabling and disabling step filters. - * - * @since 3.2 - */ -public interface IAsynchronousStepFiltersAdapter { - - /** - * Asynchronously determines whether the given element supports step filters. - * - * @param element element - * @param monitor request monitor - */ - public void supportsStepFilters(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously determines whether step filters are enabled. - * - * @param element element - * @param monitor request monitor - */ - public void isStepFiltersEnabled(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously enables or disables step filters on the given element. - * - * @param element element - * @param enabled whether step filters should be enabled - * @param monitor request monitor - */ - public void setStepFiltersEnabled(Object element, boolean enabled, IAsynchronousRequestMonitor monitor); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousSuspendResumeAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousSuspendResumeAdapter.java deleted file mode 100644 index 85c83e34b..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousSuspendResumeAdapter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Adapter for suspending and resuming. - * - * @since 3.2 - */ -public interface IAsynchronousSuspendResumeAdapter { - - /** - * Asynchronously determines whether the given element can perform a resume. - * - * @param element element - * @param monitor request monitor - */ - public void canResume(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously determines whether the given element can be suspended. - * - * @param element element - * @param monitor request monitor - */ - public void canSuspend(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously determines whether the given element is suspended. - * - * @param element element - * @param monitor request monitor - */ - public void isSuspended(Object element, IBooleanRequestMonitor monitor); - /** - * Asynchronously resumes the given element. - * - * @param element element - * @param monitor request monitor - */ - public void resume(Object element, IAsynchronousRequestMonitor monitor); - /** - * Asynchronously suspends the given element. - * - * @param element element - * @param monitor request monitor - */ - public void suspend(Object element, IAsynchronousRequestMonitor monitor); - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousTerminateAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousTerminateAdapter.java deleted file mode 100644 index 2521774d7..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IAsynchronousTerminateAdapter.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Adapter for terminating. - * - * @since 3.2 - */ -public interface IAsynchronousTerminateAdapter { - - /** - * Asynchronously determines whether the given element can be terminated. - * - * @param element element - * @param monitor request monitor - */ - public void canTerminate(Object element, IBooleanRequestMonitor monitor); - - /** - * Asynchronously determines whether the given element is terminated. - * - * @param element element - * @param monitor request monitor - */ - public void isTerminated(Object element, IBooleanRequestMonitor monitor); - - /** - * Asynchronously terminates the given element. - * - * @param element element - * @param monitor request monitor - */ - public void terminate(Object element, IAsynchronousRequestMonitor monitor); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IBooleanRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IBooleanRequestMonitor.java deleted file mode 100644 index e31dc2bb9..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/provisional/IBooleanRequestMonitor.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * 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.actions.provisional; - -import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor; - -/** - * Request monitor for obtaining a boolean result asynchronously. - * - * @since 3.2 - */ -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/contexts/DebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java index 54350b09d..d9b94e94d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.ListenerList; 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.IDebugContextProvider; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService; import org.eclipse.debug.internal.ui.views.ViewContextManager; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWindowListener; @@ -215,5 +216,12 @@ public class DebugContextManager implements IDebugContextManager { Collection sevices = fServices.values(); return (DebugWindowContextService[]) sevices.toArray(new DebugWindowContextService[sevices.size()]); } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextManager#getContextService(org.eclipse.ui.IWorkbenchWindow) + */ + public IDebugContextService getContextService(IWorkbenchWindow window) { + return createService(window); + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java index d78d0d434..19781ca16 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java @@ -19,8 +19,11 @@ 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.debug.internal.ui.contexts.provisional.DebugContextEvent; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener; import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider; +import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextService; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IPartListener2; @@ -34,16 +37,14 @@ import org.eclipse.ui.IWorkbenchWindow; * * @since 3.2 */ -public class DebugWindowContextService implements IDebugContextService, IPartListener2, IDebugContextListener { +public class DebugWindowContextService implements IDebugContextService, IPartListener2, IDebugContextEventListener { private Map fListenersByPartId = new HashMap(); private Map fProvidersByPartId = new HashMap(); + private Map fPostListenersByPartId = new HashMap(); private IWorkbenchWindow fWindow; private List fProviders = new ArrayList(); - - private static final int ACTIVATED = 1; - private static final int CHANGED = 2; public DebugWindowContextService(IWorkbenchWindow window) { fWindow = window; @@ -69,9 +70,9 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis active = activePage.getActivePart(); } if (fProviders.size() == 1 && (part == null || part.equals(active))) { - notify(ACTIVATED); + notify(DebugContextEvent.ACTIVATED); } - provider.addDebugContextListener(this); + provider.addDebugContextEventListener(this); } protected synchronized void removeProvider(IDebugContextProvider provider) { @@ -85,10 +86,10 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis fProvidersByPartId.remove(id); fProviders.remove(index); if (index == 0) { - notify(ACTIVATED); + notify(DebugContextEvent.ACTIVATED); } } - provider.removeDebugContextListener(this); + provider.removeDebugContextEventListener(this); } /* (non-Javadoc) @@ -97,6 +98,30 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis public void addDebugContextListener(IDebugContextListener listener) { addDebugContextListener(listener, null); } + + public void addPostDebugContextListener(IDebugContextListener listener, String partId) { + ListenerList list = (ListenerList) fPostListenersByPartId.get(partId); + if (list == null) { + list = new ListenerList(); + fPostListenersByPartId.put(partId, list); + } + list.add(listener); + } + + public void addPostDebugContextListener(IDebugContextListener listener) { + addPostDebugContextListener(listener, null); + } + + public void removePostDebugContextListener(IDebugContextListener listener, String partId) { + ListenerList list = (ListenerList) fPostListenersByPartId.get(partId); + if (list != null) { + list.remove(listener); + } + } + + public void removePostDebugContextListener(IDebugContextListener listener) { + removePostDebugContextListener(listener, null); + } /* (non-Javadoc) * @see org.eclipse.debug.ui.contexts.IDebugContextService#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener) @@ -119,7 +144,12 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis if (part != null) { notify(type, getListeners(part), context, part); } + notify(type, getPostListeners(null), context, part); + if (part != null) { + notify(type, getPostListeners(part), context, part); + } } + protected void notify(final int type, ListenerList list, final ISelection context, final IWorkbenchPart part) { if (list != null) { Object[] listeners = list.getListeners(); @@ -127,7 +157,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis final IDebugContextListener listener = (IDebugContextListener) listeners[i]; SafeRunner.run(new ISafeRunnable() { public void run() throws Exception { - if (type == ACTIVATED) { + if (type == DebugContextEvent.ACTIVATED) { listener.contextActivated(context, part); } else { listener.contextChanged(context, part); @@ -148,6 +178,14 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis } return (ListenerList) fListenersByPartId.get(id); } + + protected ListenerList getPostListeners(IWorkbenchPart part) { + String id = null; + if (part != null) { + id = part.getSite().getId(); + } + return (ListenerList) fPostListenersByPartId.get(id); + } /* (non-Javadoc) * @see org.eclipse.debug.ui.contexts.IDebugContextService#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener, java.lang.String) @@ -202,7 +240,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis if (index > 0) { fProviders.remove(index); fProviders.add(0, provider); - notify(ACTIVATED); + notify(DebugContextEvent.ACTIVATED); } } @@ -251,28 +289,15 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis } /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextActivated(java.lang.Object, org.eclipse.ui.IWorkbenchPart) + * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent) */ - public synchronized void contextActivated(ISelection context, IWorkbenchPart part) { + public void contextEvent(DebugContextEvent event) { if (!fProviders.isEmpty()) { IDebugContextProvider provider = (IDebugContextProvider) fProviders.get(0); - if (provider.getPart() == part) { - notify(ACTIVATED); + if (provider == event.getDebugContextProvider()) { + notify(event.getEventType()); } - } + } } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextListener#contextChanged(org.eclipse.jface.viewers.ISelection, org.eclipse.ui.IWorkbenchPart) - */ - public void contextChanged(ISelection selection, IWorkbenchPart part) { - if (!fProviders.isEmpty()) { - IDebugContextProvider provider = (IDebugContextProvider) fProviders.get(0); - if (provider.getPart() == part) { - notify(CHANGED); - } - } - } - - } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/IDebugContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/IDebugContextService.java deleted file mode 100644 index 7f871ca54..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/IDebugContextService.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * 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; - -import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener; -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); - /** - * Deregisters 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); - - /** - * Deregisters 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); - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java index 2c3c90a16..02f41bcee 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextManager.java @@ -109,5 +109,14 @@ public interface IDebugContextManager { * * @param listener */ - public void removeDebugContextListener(IDebugContextListener listener); + public void removeDebugContextListener(IDebugContextListener listener); + + /** + * Returns the context service for the specified window. + * + * @param window + * @return context service + * @since 3.3 + */ + public IDebugContextService getContextService(IWorkbenchWindow window); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java index fde85fec4..b47a43653 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/provisional/IDebugContextProvider.java @@ -32,18 +32,18 @@ public interface IDebugContextProvider { public IWorkbenchPart getPart(); /** - * Registers the given listener for context notifications. + * Registers the given listener for context events. * - * @param listener context listener + * @param listener event listener */ - public void addDebugContextListener(IDebugContextListener listener); + public void addDebugContextEventListener(IDebugContextEventListener listener); /** - * Unregisters the given listener for context notifications. + * Unregisters the given listener for context events. * - * @param listener context listener + * @param listener event listener */ - public void removeDebugContextListener(IDebugContextListener listener); + public void removeDebugContextEventListener(IDebugContextEventListener listener); /** * Returns the currently active context, possibly empty or <code>null</code>. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java index 5623f215f..26a9ad916 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java @@ -930,6 +930,9 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { return false; } } + if(getWorkingCopy() != null) { + return !getWorkingCopy().isReadOnly(); + } return true; } @@ -1004,6 +1007,11 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { return temp.toString(); } } + if(getWorkingCopy() != null) { + if(getWorkingCopy().isReadOnly()) { + return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9; + } + } return null; } @@ -1176,7 +1184,15 @@ public class LaunchConfigurationTabGroupViewer extends Viewer { * Notification that the 'Revert' button has been pressed */ protected void handleRevertPressed() { - inputChanged(getOriginal()); + try { + if(fTabGroup != null) { + fTabGroup.initializeFrom(fOriginal); + fWorkingCopy = fOriginal.getWorkingCopy(); + refresh(); + refreshStatus(); + } + } + catch (CoreException e) {DebugUIPlugin.log(e);} } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java index aada8b2e9..f1f800c82 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; @@ -108,6 +109,13 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun * Id for 'Cancel' button. */ protected static final int ID_CANCEL_BUTTON = IDialogConstants.CLIENT_ID + 3; + + /** + * The id for the 'No' button on the discard changes message box + * @since 3.3 + */ + private static final int ID_DISCARD_BUTTON = IDialogConstants.CLIENT_ID + 4; + /** * Constant specifying how wide this dialog is allowed to get (as a percentage of * total available screen width) as a result of tab labels in the edit area. @@ -852,10 +860,12 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun protected void handleClosePressed() { int status = shouldSaveCurrentConfig(); if(status != IDialogConstants.CANCEL_ID) { - if(status == IDialogConstants.YES_ID) { - getTabViewer().handleApplyPressed(); + if(status != ID_DISCARD_BUTTON) { + if(status == IDialogConstants.YES_ID) { + getTabViewer().handleApplyPressed(); + } + cancelPressed(); } - cancelPressed(); } } @@ -944,7 +954,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun */ protected void handleLaunchPressed() { ILaunchConfiguration config = getTabViewer().getOriginal(); - if (getTabViewer().isDirty()) { + if (getTabViewer().isDirty() & getTabViewer().canSave()) { getTabViewer().handleApplyPressed(); config = getTabViewer().getOriginal(); } @@ -1210,18 +1220,16 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun */ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { if (getShell() != null && getShell().isVisible()) { - if (getShell() != null) { - // Save focus control - fLastControl = getShell().getDisplay().getFocusControl(); - if (fLastControl != null && fLastControl.getShell() != getShell()) { - fLastControl = null; - } - fProgressMonitorCancelButton.setEnabled(true); - // Attach the progress monitor part to the cancel button - fProgressMonitorPart.attachToCancelComponent(fProgressMonitorCancelButton); - fProgressMonitorPart.getParent().setVisible(true); - fProgressMonitorCancelButton.setFocus(); + // Save focus control + fLastControl = getShell().getDisplay().getFocusControl(); + if (fLastControl != null && fLastControl.getShell() != getShell()) { + fLastControl = null; } + fProgressMonitorCancelButton.setEnabled(true); + // Attach the progress monitor part to the cancel button + fProgressMonitorPart.attachToCancelComponent(fProgressMonitorCancelButton); + fProgressMonitorPart.getParent().setVisible(true); + fProgressMonitorCancelButton.setFocus(); fActiveRunningOperations++; try { ModalContext.run(runnable, fork, fProgressMonitorPart, getShell().getDisplay()); @@ -1361,6 +1369,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun fLaunchConfigurationView.setAutoSelect(true); } } + if(val == IDialogConstants.NO_ID) { + val = ID_DISCARD_BUTTON; + } return val; } @@ -1454,7 +1465,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun path = sel.getPaths()[0]; pidx = findIndexOfParent(path.getFirstSegment()); if(path.getSegmentCount() == 2) { - cidx = findIndexOfChild(path.getFirstSegment(), path.getLastSegment()); + cidx = findIndexOfChild(pidx, path.getLastSegment()); } } boolean newvalue = Boolean.valueOf(event.getNewValue().toString()).booleanValue(); @@ -1476,8 +1487,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun viewer.addFilter(fLCTFilter); } } - updateSelection(path, pidx, cidx); - return null; + if(viewer.getSelection().isEmpty()) { + updateSelection(path, pidx, cidx); + } + return Status.OK_STATUS; } }; @@ -1537,7 +1550,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun sel = (pidx == 0 ? tree.getItem(pidx).getData() : tree.getItem(pidx-1).getData()); } else { - int cidex = findIndexOfChild(path.getFirstSegment(), path.getLastSegment()); + int cidex = findIndexOfChild(findIndexOfParent(path.getFirstSegment()), path.getLastSegment()); TreeItem parent = tree.getItem(pidex); int ccount = parent.getItemCount(); if(cidex == -1) { @@ -1592,9 +1605,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun * @return the index of the child or -1 if not found * @since 3.2 */ - private int findIndexOfChild(Object parent, Object child) { + private int findIndexOfChild(int pidx, Object child) { Tree tree = fLaunchConfigurationView.getTreeViewer().getTree(); - int pidx = findIndexOfParent(parent); if(pidx != -1) { TreeItem root = tree.getItem(pidx); TreeItem[] children = root.getItems(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java index 0325e1044..32a9cce1a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java @@ -88,6 +88,8 @@ public class LaunchConfigurationsMessages extends NLS { public static String LaunchConfigurationsDialog_Warning_2; public static String LaunchConfigurationsDialog_Information_3; public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3; + + public static String LaunchConfigurationTabGroupViewer_9; public static String PerspectiveManager_Error_1; public static String PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4; public static String PerspectiveManager_Unable_to_switch_to_perspective___0__2; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties index 526877f3d..626889f5f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties @@ -52,6 +52,7 @@ LaunchConfigurationTabGroupViewer_4=- Press the 'Delete' button to remove the se LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the selected configuration. LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>Perspectives</a> preference page. LaunchConfigurationTabGroupViewer_8=- Press the 'Filter' button to configure filtering options. +LaunchConfigurationTabGroupViewer_9=The file associated with this launch configuration is read-only and cannot be modified.\n LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations LaunchConfigurationDialog_Dele_te_14=De&lete LaunchConfigurationDialog_Discard_changes__38=Discard changes? @@ -68,7 +69,7 @@ LaunchConfigurationDialog_No_33=No LaunchConfigurationDialog_Ready_to_launch_2=Ready to launch LaunchConfigurationDialog_Save_changes__31=Save changes? LaunchConfigurationDialog_The_configuration___29=The configuration "{0}" has unsaved changes. Do you wish to save them? -LaunchConfigurationDialog_The_configuration___35=The configuration "{0}" has unsaved changes that CANNOT be saved because of the following error:\n +LaunchConfigurationDialog_The_configuration___35=The configuration "{0}" has unsaved changes that CANNOT be saved because of the following error:\n\n LaunchConfigurationDialog_unspecified_28=unspecified LaunchConfigurationDialog_Yes_32=Yes LaunchConfigurationDialog_Do_you_wish_to_delete_the_selected_launch_configurations__1=Do you wish to delete the selected launch configurations? diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java index bb40e8634..1a1121da8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java @@ -14,7 +14,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.debug.internal.ui.actions.context.AbstractRequestMonitor; +import org.eclipse.debug.internal.ui.commands.actions.AbstractRequestMonitor; import org.eclipse.ui.progress.WorkbenchJob; /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java index 6857fb743..b0540f0bc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.viewers.model; -import org.eclipse.debug.internal.ui.actions.context.AbstractRequestMonitor; +import org.eclipse.debug.internal.ui.commands.actions.AbstractRequestMonitor; import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.jface.resource.ImageDescriptor; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java index 14b2aaf39..52f95381f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.debug.internal.ui.viewers.model; -import org.eclipse.debug.internal.ui.actions.context.AbstractRequestMonitor; +import org.eclipse.debug.internal.ui.commands.actions.AbstractRequestMonitor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.ui.IMemento; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java index 85c87ace3..6b949abab 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java @@ -14,7 +14,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.debug.internal.ui.actions.context.AbstractRequestMonitor; +import org.eclipse.debug.internal.ui.commands.actions.AbstractRequestMonitor; import org.eclipse.debug.internal.ui.viewers.AsynchronousSchedulingRuleFactory; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index d242ed05b..7b457131e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -14,10 +14,7 @@ package org.eclipse.debug.internal.ui.views.launch; import java.util.Iterator; import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.SafeRunner; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -32,21 +29,22 @@ import org.eclipse.debug.internal.ui.DelegatingModelPresentation; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.internal.ui.actions.AddToFavoritesAction; import org.eclipse.debug.internal.ui.actions.EditLaunchConfigurationAction; -import org.eclipse.debug.internal.ui.actions.context.AbstractDebugContextAction; -import org.eclipse.debug.internal.ui.actions.context.DisconnectAction; -import org.eclipse.debug.internal.ui.actions.context.DropToFrameAction; -import org.eclipse.debug.internal.ui.actions.context.ResumeAction; -import org.eclipse.debug.internal.ui.actions.context.StepIntoAction; -import org.eclipse.debug.internal.ui.actions.context.StepOverAction; -import org.eclipse.debug.internal.ui.actions.context.StepReturnAction; -import org.eclipse.debug.internal.ui.actions.context.SuspendAction; -import org.eclipse.debug.internal.ui.actions.context.TerminateAction; -import org.eclipse.debug.internal.ui.actions.context.TerminateAllAction; -import org.eclipse.debug.internal.ui.actions.context.TerminateAndRelaunchAction; -import org.eclipse.debug.internal.ui.actions.context.TerminateAndRemoveAction; +import org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.DisconnectCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.DropToFrameCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.ResumeCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.StepOverCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.SuspendCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.TerminateAllAction; +import org.eclipse.debug.internal.ui.commands.actions.TerminateAndRelaunchAction; +import org.eclipse.debug.internal.ui.commands.actions.TerminateAndRemoveAction; +import org.eclipse.debug.internal.ui.commands.actions.TerminateCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.ToggleStepFiltersAction; 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.IDebugContextProvider; +import org.eclipse.debug.internal.ui.contexts.provisional.AbstractDebugContextProvider; +import org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent; import org.eclipse.debug.internal.ui.sourcelookup.EditSourceLookupPathAction; import org.eclipse.debug.internal.ui.sourcelookup.LookupSourceAction; import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer; @@ -66,7 +64,6 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; @@ -117,6 +114,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi private static final String TERMINATE_ALL = "terminate_all"; //$NON-NLS-1$ private static final String TERMINATE_AND_RELAUNCH = "terminate_relaunch"; //$NON-NLS-1$ + + private static final String TOGGLE_STEP_FILTERS = "toggle_step_filters"; //$NON-NLS-1$ /** * Whether this view is in the active page of a perspective. @@ -124,7 +123,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi private boolean fIsActive = true; /** - * Editor presentation or <code>null</code> if none + * Model presentation or <code>null</code> if none */ private IDebugModelPresentation fPresentation = null; @@ -133,64 +132,31 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi private EditSourceLookupPathAction fEditSourceAction = null; private LookupSourceAction fLookupAction = null; - class ContextProvider implements IDebugContextProvider { - /** - * Context listeners - */ - private ListenerList fListeners = new ListenerList(); + class ContextProvider extends AbstractDebugContextProvider { + public ContextProvider() { + super(LaunchView.this); + // TODO Auto-generated constructor stub + } + private ISelection fContext = null; protected void dispose() { fContext = null; - fListeners.clear(); } /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#getPart() - */ - public IWorkbenchPart getPart() { - return LaunchView.this; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#addDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener) - */ - public void addDebugContextListener(IDebugContextListener listener) { - fListeners.add(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#removeDebugContextListener(org.eclipse.debug.ui.contexts.IDebugContextListener) - */ - public void removeDebugContextListener(IDebugContextListener listener) { - fListeners.remove(listener); - } - - /* (non-Javadoc) * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#getActiveContext() */ public synchronized ISelection getActiveContext() { return fContext; } - protected void activate(final ISelection selection) { + protected void activate(ISelection selection) { synchronized (this) { fContext = selection; } - Object[] listeners = fListeners.getListeners(); - for (int i = 0; i < listeners.length; i++) { - final IDebugContextListener listener = (IDebugContextListener) listeners[i]; - SafeRunner.run(new ISafeRunnable() { - public void run() throws Exception { - listener.contextActivated(selection, ContextProvider.this.getPart()); - } - public void handleException(Throwable exception) { - DebugUIPlugin.log(exception); - } - }); - - } + fire(new DebugContextEvent(this, selection, DebugContextEvent.ACTIVATED)); } protected void possibleContextChange(Object element) { @@ -204,20 +170,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi return; } } - Object[] listeners = fListeners.getListeners(); - final IStructuredSelection context = new StructuredSelection(element); - for (int i = 0; i < listeners.length; i++) { - final IDebugContextListener listener = (IDebugContextListener) listeners[i]; - SafeRunner.run(new ISafeRunnable() { - public void run() throws Exception { - listener.contextChanged(context, ContextProvider.this.getPart()); - } - public void handleException(Throwable exception) { - DebugUIPlugin.log(exception); - } - }); - - } + fire(new DebugContextEvent(this, fContext, DebugContextEvent.CHANGED)); } } @@ -243,45 +196,44 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi fAddToFavoritesAction = new AddToFavoritesAction(); fEditSourceAction = new EditSourceLookupPathAction(this); fLookupAction = new LookupSourceAction(this); - //setAction(FIND_ACTION, new FindElementAction(this, (AsynchronousTreeViewer) getViewer())); + //setAction(FIND_ACTION, new FindElementAction(this, (AsynchronousTreeViewer) getViewer())); // TODO: - - IWorkbenchWindow window = getSite().getWorkbenchWindow(); - TerminateAction terminateAction = new TerminateAction(); - terminateAction.init(window); - setAction(TERMINATE, terminateAction); - DisconnectAction disconnectAction = new DisconnectAction(); - disconnectAction.init(window); - setAction(DISCONNECT, disconnectAction); - SuspendAction suspendAction = new SuspendAction(); - suspendAction.init(window); - setAction(SUSPEND, suspendAction); - ResumeAction resumeAction = new ResumeAction(); - resumeAction.init(window); - setAction(RESUME, resumeAction); - StepReturnAction stepReturnAction = new StepReturnAction(); - stepReturnAction.init(window); - setAction(STEP_RETURN, stepReturnAction); - StepOverAction stepOverAction = new StepOverAction(); - stepOverAction.init(window); - setAction(STEP_OVER, stepOverAction); - StepIntoAction stepIntoAction = new StepIntoAction(); - stepIntoAction.init(window); - setAction(STEP_INTO, stepIntoAction); - DropToFrameAction dropToFrameAction = new DropToFrameAction(); - dropToFrameAction.init(window); - setAction(DROP_TO_FRAME, dropToFrameAction); - TerminateAndRemoveAction terminateAndRemoveAction = new TerminateAndRemoveAction(); - terminateAndRemoveAction.init(window); - setAction(TERMINATE_AND_REMOVE, terminateAndRemoveAction); - TerminateAllAction terminateAll = new TerminateAllAction(); - terminateAll.init(window); - setAction(TERMINATE_ALL, terminateAll); - TerminateAndRelaunchAction terminateAndRelaunchAction = new TerminateAndRelaunchAction(); - terminateAndRelaunchAction.init(window); - setAction(TERMINATE_AND_RELAUNCH, terminateAndRelaunchAction); + addCapabilityAction(new TerminateCommandAction(), TERMINATE); + addCapabilityAction(new DisconnectCommandAction(), DISCONNECT); + addCapabilityAction(new SuspendCommandAction(), SUSPEND); + addCapabilityAction(new ResumeCommandAction(), RESUME); + addCapabilityAction(new StepReturnCommandAction(), STEP_RETURN); + addCapabilityAction(new StepOverCommandAction(), STEP_OVER); + addCapabilityAction(new StepIntoCommandAction(), STEP_INTO); + addCapabilityAction(new DropToFrameCommandAction(), DROP_TO_FRAME); + addCapabilityAction(new TerminateAndRemoveAction(), TERMINATE_AND_REMOVE); + addCapabilityAction(new TerminateAndRelaunchAction(), TERMINATE_AND_RELAUNCH); + addCapabilityAction(new TerminateAllAction(), TERMINATE_ALL); + addCapabilityAction(new ToggleStepFiltersAction(), TOGGLE_STEP_FILTERS); } + + /** + * Initializes the action and associates it with the given id. + * + * @param capability + * @param actionID + */ + private void addCapabilityAction(DebugCommandAction capability, String actionID) { + capability.init(this); + setAction(actionID, capability); + } + + /** + * Disposes the given action. + * + * @param actionID + */ + private void disposeCommandAction(String actionID) { + DebugCommandAction action = (DebugCommandAction) getAction(actionID); + action.dispose(); + } + /* (non-Javadoc) * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite) */ @@ -299,6 +251,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi } } }); + final DelegatingModelPresentation presentation = new DelegatingModelPresentation(); + fPresentation = presentation; // add my viewer as a selection provider, so selective re-launch works getSite().setSelectionProvider(viewer); viewer.setInput(DebugPlugin.getDefault().getLaunchManager()); @@ -430,6 +384,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi tbm.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN)); tbm.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME)); + + tbm.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS)); } /* (non-Javadoc) @@ -460,28 +416,17 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi PropertyDialogAction properties = (PropertyDialogAction) getAction("Properties"); //$NON-NLS-1$ properties.dispose(); - AbstractDebugContextAction action = (AbstractDebugContextAction) getAction(TERMINATE); - action.dispose(); - action = (AbstractDebugContextAction) getAction(DISCONNECT); - action.dispose(); - action = (AbstractDebugContextAction) getAction(SUSPEND); - action.dispose(); - action = (AbstractDebugContextAction) getAction(RESUME); - action.dispose(); - action = (AbstractDebugContextAction) getAction(STEP_RETURN); - action.dispose(); - action = (AbstractDebugContextAction) getAction(STEP_OVER); - action.dispose(); - action = (AbstractDebugContextAction) getAction(STEP_INTO); - action.dispose(); - action = (AbstractDebugContextAction) getAction(DROP_TO_FRAME); - action.dispose(); - action = (AbstractDebugContextAction) getAction(TERMINATE_AND_REMOVE); - action.dispose(); - action = (AbstractDebugContextAction) getAction(TERMINATE_ALL); - action.dispose(); - action = (AbstractDebugContextAction) getAction(TERMINATE_AND_RELAUNCH); - action.dispose(); + disposeCommandAction(TERMINATE); + disposeCommandAction(DISCONNECT); + disposeCommandAction(SUSPEND); + disposeCommandAction(RESUME); + disposeCommandAction(STEP_RETURN); + disposeCommandAction(STEP_OVER); + disposeCommandAction(STEP_INTO); + disposeCommandAction(DROP_TO_FRAME); + disposeCommandAction(TERMINATE_AND_REMOVE); + disposeCommandAction(TERMINATE_AND_RELAUNCH); + disposeCommandAction(TERMINATE_ALL); } /** @@ -611,6 +556,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi menu.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN)); menu.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME)); + + menu.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS)); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java index 770942229..d3470f352 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java @@ -72,7 +72,7 @@ import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.ide.IDEEncoding; import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; -import org.eclipse.ui.views.navigator.ResourceSorter; +import org.eclipse.ui.views.navigator.ResourceComparator; import com.ibm.icu.text.MessageFormat; @@ -247,7 +247,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13); dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); - dialog.setSorter(new ResourceSorter(ResourceSorter.NAME)); + dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); if (dialog.open() == IDialogConstants.OK_ID) { IResource resource = (IResource) dialog.getFirstResult(); String arg = resource.getFullPath().toString(); @@ -700,7 +700,6 @@ public class CommonTab extends AbstractLaunchConfigurationTab { return false; } } - return true; } |