1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

[275687] Moving Reverse commands to the core of CDT from DSF-GDB, and making use of the new asynchronous command framework of the debug platform

This commit is contained in:
Marc Khouzam 2009-12-16 20:32:47 +00:00
parent ffd9215e3f
commit 370ef8a824
32 changed files with 1034 additions and 934 deletions

View file

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* Handler interface to perform a reverse Resume operation
* @since 6.1
*/
public interface IReverseResumeHandler extends IDebugCommandHandler {
}

View file

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* Handler interface to perform a reverse StepInto operation
* @since 6.1
*/
public interface IReverseStepIntoHandler extends IDebugCommandHandler {
}

View file

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* Handler interface to perform a reverse StepOver operation
* @since 6.1
*/
public interface IReverseStepOverHandler extends IDebugCommandHandler {
}

View file

@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* Handler interface to toggle reverse debugging
* @since 6.1
*/
public interface IReverseToggleHandler extends IDebugCommandHandler {
/**
* Method to indicate if the IElementUpdate logic should be used
* to update the checked state of the corresponding command.
* {@link isReverseToggle} will only be used if this method returns true.
*/
boolean toggleNeedsUpdating();
/**
* Method that returns if the toggle button should show as checked or not.
* Only used if {@link toggleNeedsUpdating} return true.
*
* @param context The currently selected context.
* @return if the reverse toggle button should show as checked or not.
*/
boolean isReverseToggled(Object context);
}

View file

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
/**
* Handler interface to perform an Uncall operation (reverse debugging)
* @since 6.1
*/
public interface IUncallHandler extends IDebugCommandHandler {
}

View file

@ -198,4 +198,22 @@ CApplicationShortcut.label=Local C/C++ Application
ContextualRunCApplication.description=Runs a local C/C++ application
ContextualDebugCApplication.description=Debugs a local C/C++ application
# Reverse debugging
ReverseActionSet.label = Reverse Debugging
ReverseDebuggingCategory.name = Reverse Debugging Commands
ReverseDebuggingCategory.description = Set of commands for Reverse Debugging
ReverseToggle.name = Reverse Toggle
ReverseToggle.description = Toggle Reverse Debugging
ReverseToggle.label = Toggle Reverse Debugging
ReverseResume.name = Reverse Resume
ReverseResume.description = Perform Reverse Resume
ReverseResume.label = Reverse Resume
ReverseStepInto.name = Reverse StepInto
ReverseStepInto.description = Perform Reverse StepInto
ReverseStepInto.label = Reverse StepInto
ReverseStepOver.name = Reverse StepOver
ReverseStepOver.description = Perform Reverse StepOver
ReverseStepOver.label = Reverse StepOver
Uncall.name = Uncall
Uncall.description = Perform Uncall
Uncall.label = Uncall

View file

@ -1908,5 +1908,365 @@
</enablement>
</toggleTargetFactory>
</extension>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
id="org.eclipse.cdt.debug.ui.reverseDebuggingActionSet"
label="%ReverseActionSet.label"
visible="false">
</actionSet>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
description="%ReverseDebuggingCategory.description"
id="org.eclipse.cdt.debug.ui.category.reverseDebugging"
name="%ReverseDebuggingCategory.name">
</category>
<command
categoryId="org.eclipse.cdt.debug.ui.category.reverseDebugging"
description="%ReverseToggle.description"
id="org.eclipse.cdt.debug.ui.command.reverseToggle"
name="%ReverseToggle.name">
</command>
<command
categoryId="org.eclipse.cdt.debug.ui.category.reverseDebugging"
description="%ReverseResume.description"
id="org.eclipse.cdt.debug.ui.command.reverseResume"
name="%ReverseResume.name">
</command>
<command
categoryId="org.eclipse.cdt.debug.ui.category.reverseDebugging"
description="%ReverseStepOver.description"
id="org.eclipse.cdt.debug.ui.command.reverseStepOver"
name="%ReverseStepOver.name">
</command>
<command
categoryId="org.eclipse.cdt.debug.ui.category.reverseDebugging"
description="%ReverseStepInto.description"
id="org.eclipse.cdt.debug.ui.command.reverseStepInto"
name="%ReverseStepInto.name">
</command>
<command
categoryId="org.eclipse.cdt.debug.ui.category.reverseDebugging"
description="%Uncall.description"
id="org.eclipse.cdt.debug.ui.command.uncall"
name="%Uncall.name">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.cdt.debug.internal.ui.commands.ReverseToggleCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.commands.ReverseResumeCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.reverseResume">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.commands.ReverseStepIntoCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.reverseStepInto">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.commands.ReverseStepOverCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.reverseStepOver">
</handler>
<handler
class="org.eclipse.cdt.debug.internal.ui.commands.UncallCommandHandler"
commandId="org.eclipse.cdt.debug.ui.command.uncall">
</handler>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive">
<with
variable="activeContexts">
<iterate
operator="or">
<equals
value="org.eclipse.cdt.debug.ui.reverseDebuggingActionSet">
</equals>
</iterate>
</with>
</definition>
<definition
id="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
<and>
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive">
</reference>
<or>
<with
variable="activePart">
<test
property="org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled">
</test>
</with>
<with
variable="selection">
<test
property="org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled">
</test>
</with>
</or>
</and>
</definition>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="org.eclipse.cdt.debug.ui.command.reverseResume"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F8">
</key>
<key
commandId="org.eclipse.cdt.debug.ui.command.reverseStepInto"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F5">
</key>
<key
commandId="org.eclipse.cdt.debug.ui.command.reverseStepOver"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F6">
</key>
<key
commandId="org.eclipse.cdt.debug.ui.command.uncall"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F7">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=additions">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
icon="icons/obj16/reverse_toggle.gif"
label="%ReverseToggle.label"
style="toggle">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=threadGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseResume"
icon="icons/obj16/reverse_resume.gif"
label="%ReverseResume.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=stepIntoGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseStepInto"
icon="icons/obj16/reverse_stepinto.gif"
label="%ReverseStepInto.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=stepOverGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseStepOver"
icon="icons/obj16/reverse_stepover.gif"
label="%ReverseStepOver.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=stepReturnGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.uncall"
icon="icons/obj16/uncall.gif"
label="%Uncall.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
icon="icons/obj16/reverse_toggle.gif"
label="%ReverseToggle.label"
style="toggle">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?after=stepGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseResume"
icon="icons/obj16/reverse_resume.gif"
label="%ReverseResume.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepIntoGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseStepInto"
icon="icons/obj16/reverse_stepinto.gif"
label="%ReverseStepInto.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepOverGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseStepOver"
icon="icons/obj16/reverse_stepover.gif"
label="%ReverseStepOver.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepReturnGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.uncall"
icon="icons/obj16/uncall.gif"
label="%Uncall.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseToggle"
icon="icons/obj16/reverse_toggle.gif"
label="%ReverseToggle.label"
style="toggle">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?after=threadGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseResume"
icon="icons/obj16/reverse_resume.gif"
label="%ReverseResume.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepIntoGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseStepInto"
icon="icons/obj16/reverse_stepinto.gif"
label="%ReverseStepInto.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepOverGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.reverseStepOver"
icon="icons/obj16/reverse_stepover.gif"
label="%ReverseStepOver.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepReturnGroup">
<command
commandId="org.eclipse.cdt.debug.ui.command.uncall"
icon="icons/obj16/uncall.gif"
label="%Uncall.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.debug.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
</plugin>

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.commands;
import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to trigger a reverse resume operation
*
* @since 6.1
*/
public class ReverseResumeCommandHandler extends DebugCommandHandler {
@Override
protected Class<?> getCommandType() {
return IReverseResumeHandler.class;
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.commands;
import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to trigger a reverse stepinto operation
*
* @since 6.1
*/
public class ReverseStepIntoCommandHandler extends DebugCommandHandler {
@Override
protected Class<?> getCommandType() {
return IReverseStepIntoHandler.class;
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.commands;
import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to trigger a reverse stepover operation
*
* @since 6.1
*/
public class ReverseStepOverCommandHandler extends DebugCommandHandler {
@Override
protected Class<?> getCommandType() {
return IReverseStepOverHandler.class;
}
}

View file

@ -0,0 +1,122 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.commands;
import java.util.Map;
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.DebugCommandHandler;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
/**
* Command handler to toggle reverse debugging mode
*
* @since 6.1
*/
public class ReverseToggleCommandHandler extends DebugCommandHandler implements IDebugContextListener, IElementUpdater {
@Override
protected Class<?> getCommandType() {
return IReverseToggleHandler.class;
}
//
// The below logic allows us to keep the checked state of the toggle button
// properly set. This is because in some case, the checked state may change
// without the user actually pressing the button. For instance, if we restart
// the inferior, the toggle may automatically turn off.
// To figure this out, whenever a debug context changes, we make sure we are
// showing the proper checked state.
//
// We must hard-code the command id so as to know it from the very start (bug 290699)
private static final String REVERSE_TOGGLE_COMMAND_ID = "org.eclipse.cdt.debug.ui.command.reverseToggle"; //$NON-NLS-1$
private Object fActiveContext = null;
private IReverseToggleHandler fTargetAdapter = null;
private IDebugContextService fContextService = null;
public ReverseToggleCommandHandler() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
fContextService = DebugUITools.getDebugContextManager().getContextService(window);
fContextService.addPostDebugContextListener(this);
// This constructor might be called after the launch, so we must refresh here too.
// This can happen if we activate the action set after the launch.
refresh(fContextService.getActiveContext());
}
@Override
public void dispose() {
// Must use the stored service. If we try to fetch the service
// again with the workbenchWindow, it may fail if the window is
// already closed.
fContextService.removePostDebugContextListener(this);
fTargetAdapter = null;
super.dispose();
}
public void debugContextChanged(DebugContextEvent event) {
refresh(event.getContext());
}
private void refresh(ISelection selection) {
fTargetAdapter = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (!ss.isEmpty()) {
fActiveContext = ss.getFirstElement();
if (fActiveContext instanceof IAdaptable) {
fTargetAdapter = getAdapter((IAdaptable) fActiveContext);
}
}
}
ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService != null) {
commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null);
}
}
private IReverseToggleHandler getAdapter(IAdaptable adaptable) {
IReverseToggleHandler adapter = (IReverseToggleHandler)adaptable.getAdapter(IReverseToggleHandler.class);
if (adapter == null) {
IAdapterManager adapterManager = Platform.getAdapterManager();
if (adapterManager.hasAdapter(adaptable, getCommandType().getName())) {
adapter = (IReverseToggleHandler)adapterManager.loadAdapter(adaptable, IReverseToggleHandler.class.getName());
}
}
return adapter;
}
public void updateElement(UIElement element,
@SuppressWarnings("unchecked") Map parameters) {
// Make sure the toggle state reflects the actual state
// We must check this, in case we have multiple launches
// or if we re-launch (restart)
if (fTargetAdapter != null && fTargetAdapter.toggleNeedsUpdating()){
boolean toggled = fTargetAdapter.isReverseToggled(fActiveContext);
element.setChecked(toggled);
}
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.commands;
import org.eclipse.cdt.debug.core.model.IUncallHandler;
import org.eclipse.debug.ui.actions.DebugCommandHandler;
/**
* Command handler to trigger an uncall operation
*
* @since 6.1
*/
public class UncallCommandHandler extends DebugCommandHandler {
@Override
protected Class<?> getCommandType() {
return IUncallHandler.class;
}
}

View file

@ -15,28 +15,6 @@ providerName=Eclipse CDT
action.connect.label = Connect...
action.connect.tooltip = Connect to a process
actionSet.reverse.label = Reverse Debugging
actionSet.reverse.description = Reverse Debugging
command.reverseCategory.name = Reverse Debugging Commands
command.reverseCategory.description = Set of commands for Reverse Debugging
command.reverseToggle.name = Reverse Toggle
command.reverseToggle.description = Toggle Reverse Debugging
command.reverseToggle.label = Toggle Reverse Debugging
command.reverseResume.name = Reverse Resume
command.reverseResume.description = Perform Reverse Resume
command.reverseResume.label = Reverse Resume
command.reverseStepInto.name = Reverse StepInto
command.reverseStepInto.description = Perform Reverse StepInto
command.reverseStepInto.label = Reverse StepInto
command.reverseStepOver.name = Reverse StepOver
command.reverseStepOver.description = Perform Reverse StepOver
command.reverseStepOver.label = Reverse StepOver
command.uncall.name = Uncall
command.uncall.description = Perform Uncall
command.uncall.label = Uncall
gdbPreferencePage.name = GDB
launchTab.main.name=Main

View file

@ -266,325 +266,8 @@
</action>
</viewContribution>
</extension>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
description="%actionSet.reverse.description"
id="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingActionSet"
label="%actionSet.reverse.label"
visible="false">
</actionSet>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
description="%command.reverseCategory.description"
id="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingCategory"
name="%command.reverseCategory.name">
</category>
<command
categoryId="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingCategory"
description="%command.reverseToggle.description"
id="org.eclipse.cdt.dsf.gdb.ui.commands.reverseToggle"
name="%command.reverseToggle.name">
</command>
<command
categoryId="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingCategory"
description="%command.reverseResume.description"
id="org.eclipse.cdt.dsf.gdb.ui.commands.reverseResume"
name="%command.reverseResume.name">
</command>
<command
categoryId="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingCategory"
description="%command.reverseStepInto.description"
id="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepInto"
name="%command.reverseStepInto.name">
</command>
<command
categoryId="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingCategory"
description="%command.reverseStepOver.description"
id="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepOver"
name="%command.reverseStepOver.name">
</command>
<command
categoryId="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingCategory"
description="%command.uncall.description"
id="org.eclipse.cdt.dsf.gdb.ui.commands.uncall"
name="%command.uncall.name">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=additions">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseToggle"
icon="icons/full/obj16/reversetoggle.gif"
id="org.eclipse.cdt.dsf.gdb.ui.button.reverseToggle"
label="%command.reverseToggle.label"
style="toggle">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=threadGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseResume"
icon="icons/full/obj16/reverseresume.gif"
label="%command.reverseResume.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=stepIntoGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepInto"
icon="icons/full/obj16/reversestepinto.gif"
label="%command.reverseStepInto.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=stepOverGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepOver"
icon="icons/full/obj16/reversestepover.gif"
label="%command.reverseStepOver.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.debug.ui.DebugView?after=stepReturnGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.uncall"
icon="icons/full/obj16/uncall.gif"
label="%command.uncall.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseToggle"
icon="icons/full/obj16/reversetoggle.gif"
id="org.eclipse.cdt.dsf.gdb.ui.button.reverseToggle"
label="%command.reverseToggle.label"
style="toggle">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?after=stepGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseResume"
icon="icons/full/obj16/reverseresume.gif"
label="%command.reverseResume.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepIntoGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepInto"
icon="icons/full/obj16/reversestepinto.gif"
label="%command.reverseStepInto.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepOverGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepOver"
icon="icons/full/obj16/reversestepover.gif"
label="%command.reverseStepOver.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.run?before=stepReturnGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.uncall"
icon="icons/full/obj16/uncall.gif"
label="%command.uncall.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseToggle"
icon="icons/full/obj16/reversetoggle.gif"
id="org.eclipse.cdt.dsf.gdb.ui.button.reverseToggle"
label="%command.reverseToggle.label"
style="toggle">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingActionSetActive">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?after=threadGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseResume"
icon="icons/full/obj16/reverseresume.gif"
label="%command.reverseResume.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepIntoGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepInto"
icon="icons/full/obj16/reversestepinto.gif"
label="%command.reverseStepInto.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepOverGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepOver"
icon="icons/full/obj16/reversestepover.gif"
label="%command.reverseStepOver.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.debug.ui.DebugView?before=stepReturnGroup">
<command
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.uncall"
icon="icons/full/obj16/uncall.gif"
label="%command.uncall.label"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
</reference>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseResume"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F8">
</key>
<key
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepInto"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F5">
</key>
<key
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepOver"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F6">
</key>
<key
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.uncall"
contextId="org.eclipse.cdt.debug.ui.debugging"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F7">
</key>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingActionSetActive">
<with
variable="activeContexts">
<iterate
operator="or">
<equals
value="org.eclipse.cdt.dsf.gdb.ui.reverseDebuggingActionSet">
</equals>
</iterate>
</with>
</definition>
<definition
id="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
<with
@ -596,94 +279,20 @@
</test>
</with>
</definition>
<definition
id="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingEnabled">
<and>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
</reference>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsReverseDebuggingActionSetActive">
</reference>
<or>
<with
variable="activePart">
<test
property="org.eclipse.cdt.dsf.gdb.ui.isReverseDebuggingEnabled">
</test>
</with>
<with
variable="selection">
<test
property="org.eclipse.cdt.dsf.gdb.ui.isReverseDebuggingEnabled">
</test>
</with>
</or>
</and>
</definition>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseToggleCommandHandler"
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseToggle">
<enabledWhen>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
</reference>
</enabledWhen>
</handler>
<handler
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseResumeCommandHandler"
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseResume">
<enabledWhen>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
</reference>
</enabledWhen>
</handler>
<handler
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseStepIntoCommandHandler"
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepInto">
<enabledWhen>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
</reference>
</enabledWhen>
</handler>
<handler
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseStepOverCommandHandler"
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.reverseStepOver">
<enabledWhen>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
</reference>
</enabledWhen>
</handler>
<handler
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.UncallCommandHandler"
commandId="org.eclipse.cdt.dsf.gdb.ui.commands.uncall">
<enabledWhen>
<reference
definitionId="org.eclipse.cdt.dsf.gdb.ui.testIsGdbUIPluginActive">
</reference>
</enabledWhen>
</handler>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseDebuggingPropertyTester"
id="org.eclipse.cdt.dsf.gdb.ui.selectionReverseDebuggingTester"
namespace="org.eclipse.cdt.dsf.gdb.ui"
namespace="org.eclipse.cdt.debug.ui"
properties="isReverseDebuggingEnabled"
type="org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext">
</propertyTester>
<propertyTester
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseDebuggingPropertyTester"
id="org.eclipse.cdt.dsf.gdb.ui.partReverseDebuggingTester"
namespace="org.eclipse.cdt.dsf.gdb.ui"
namespace="org.eclipse.cdt.debug.ui"
properties="isReverseDebuggingEnabled"
type="org.eclipse.ui.IWorkbenchPart">
</propertyTester>

View file

@ -16,7 +16,12 @@ import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
import org.eclipse.cdt.debug.core.model.IUncallHandler;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand;
@ -31,21 +36,16 @@ import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.DefaultRefreshAllTarget;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.IRefreshAllTarget;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory;
import org.eclipse.cdt.dsf.gdb.actions.IConnect;
import org.eclipse.cdt.dsf.gdb.actions.IReverseResumeHandler;
import org.eclipse.cdt.dsf.gdb.actions.IReverseStepIntoHandler;
import org.eclipse.cdt.dsf.gdb.actions.IReverseStepOverHandler;
import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
import org.eclipse.cdt.dsf.gdb.actions.IUncallHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.DsfTerminateCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbConnectCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbDisconnectCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseResumeCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseStepIntoCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseStepOverCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbReverseToggleCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSteppingModeTarget;
import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbUncallCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseResumeCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepIntoCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepOverCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseToggleCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbUncallCommand;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.GdbViewModelAdapter;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;

View file

@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.debug.ui.DebugUITools;
@ -54,15 +54,15 @@ public class ReverseDebuggingPropertyTester extends PropertyTester {
}
private boolean test(IDMVMContext context) {
boolean result = false;
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(context.getDMContext(), ICommandControlDMContext.class);
if (controlDmc != null) {
IReverseToggleHandler toggle = (IReverseToggleHandler)(controlDmc.getAdapter(IReverseToggleHandler.class));
if (toggle != null) {
boolean t= toggle.isReverseToggled(controlDmc);
return t;
result = toggle.isReverseToggled(controlDmc);
}
}
return false;
return result;
}
private static Object getContextSelectionForPart(IWorkbenchPart part) {

View file

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import org.eclipse.cdt.dsf.gdb.actions.IReverseResumeHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
/**
* Command handler to trigger a reverse resume operation
*
* @since 2.0
*/
public class ReverseResumeCommandHandler extends RetargetDebugContextCommand {
@Override
protected boolean canPerformCommand(Object target, ISelection debugContext) {
return ((IReverseResumeHandler)target).canReverseResume(debugContext);
}
@Override
protected Class<?> getAdapterClass() {
return IReverseResumeHandler.class;
}
@Override
protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
((IReverseResumeHandler)target).reverseResume(debugContext);
}
}

View file

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import org.eclipse.cdt.dsf.gdb.actions.IReverseStepIntoHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
/**
* Command handler to trigger a reverse stepinto operation
*
* @since 2.0
*/
public class ReverseStepIntoCommandHandler extends RetargetDebugContextCommand {
@Override
protected boolean canPerformCommand(Object target, ISelection debugContext) {
return ((IReverseStepIntoHandler)target).canReverseStepInto(debugContext);
}
@Override
protected Class<?> getAdapterClass() {
return IReverseStepIntoHandler.class;
}
@Override
protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
((IReverseStepIntoHandler)target).reverseStepInto(debugContext);
}
}

View file

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import org.eclipse.cdt.dsf.gdb.actions.IReverseStepOverHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
/**
* Command handler to trigger a reverse stepover operation
*
* @since 2.0
*/
public class ReverseStepOverCommandHandler extends RetargetDebugContextCommand {
@Override
protected boolean canPerformCommand(Object target, ISelection debugContext) {
return ((IReverseStepOverHandler)target).canReverseStepOver(debugContext);
}
@Override
protected Class<?> getAdapterClass() {
return IReverseStepOverHandler.class;
}
@Override
protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
((IReverseStepOverHandler)target).reverseStepOver(debugContext);
}
}

View file

@ -1,55 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import java.util.Map;
import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
/**
* Command handler to toggle reverse debugging mode
*
* @since 2.0
*/
public class ReverseToggleCommandHandler extends RetargetDebugContextCommand implements IElementUpdater {
@Override
protected boolean canPerformCommand(Object target, ISelection debugContext) {
return ((IReverseToggleHandler)target).canToggleReverse(debugContext);
}
@Override
protected Class<?> getAdapterClass() {
return IReverseToggleHandler.class;
}
@Override
protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
((IReverseToggleHandler)target).toggleReverse(debugContext);
}
public void updateElement(UIElement element, Map parameters) {
// Make sure the toggle state reflects the actual state
// We must check this, in case we have multiple launches
// or if we re-launch
if (getTargetAdapter() == null) {
element.setChecked(false);
} else {
boolean toggled = ((IReverseToggleHandler)getTargetAdapter()).isReverseToggled(getDebugContext());
element.setChecked(toggled);
}
}
}

View file

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009 Ericsson 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
import org.eclipse.cdt.dsf.gdb.actions.IUncallHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.commands.RetargetDebugContextCommand;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
/**
* Command handler to trigger an uncall operation
*
* @since 2.0
*/
public class UncallCommandHandler extends RetargetDebugContextCommand {
@Override
protected boolean canPerformCommand(Object target, ISelection debugContext) {
return ((IUncallHandler)target).canUncall(debugContext);
}
@Override
protected Class<?> getAdapterClass() {
return IUncallHandler.class;
}
@Override
protected void performCommand(Object target, ISelection debugContext) throws ExecutionException {
((IUncallHandler)target).uncall(debugContext);
}
}

View file

@ -8,7 +8,7 @@
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import java.util.concurrent.ExecutionException;
@ -27,14 +27,20 @@ import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.core.commands.AbstractDebugCommand;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* @since 2.0
/**
* Base class handling the work of a Reverse Step command.
*
* @since 2.1
*/
@Immutable
public abstract class GdbAbstractReverseStepCommand {
public abstract class GdbAbstractReverseStepCommand extends AbstractDebugCommand {
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
@ -52,12 +58,53 @@ public abstract class GdbAbstractReverseStepCommand {
fTracker.dispose();
}
protected boolean canReverseStep(ISelection debugContext) {
final IExecutionDMContext dmc = getContext(debugContext);
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
if (dmc == null) {
return false;
return;
}
final StepType stepType = getStepType();
Query<Object> reverseStepQuery = new Query<Object>() {
@Override
public void execute(DataRequestMonitor<Object> rm) {
IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.reverseStep(dmc, stepType, rm);
} else {
rm.done();
}
}
};
try {
fExecutor.execute(reverseStepQuery);
reverseStepQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
throws CoreException
{
if (targets.length != 1) {
return false;
}
final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
if (dmc == null) {
return false;
}
final StepType stepType = getStepType();
Query<Boolean> canReverseQuery = new Query<Boolean>() {
@ -83,55 +130,23 @@ public abstract class GdbAbstractReverseStepCommand {
}
return false;
}
protected void reverseStep(ISelection debugContext) {
final IExecutionDMContext dmc = getContext(debugContext);
if (dmc == null) {
return;
}
final StepType stepType = getStepType();
Query<Object> reverseStepQuery = new Query<Object>() {
@Override
public void execute(DataRequestMonitor<Object> rm) {
IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.reverseStep(dmc, stepType, rm);
} else {
rm.setData(false);
rm.done();
}
}
};
try {
fExecutor.execute(reverseStepQuery);
reverseStepQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
}
private IExecutionDMContext getContext(ISelection debugContext) {
if (debugContext instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) debugContext;
if (!ss.isEmpty()) {
Object object = ss.getFirstElement();
if (object instanceof IDMVMContext) {
return DMContexts.getAncestorOfType(((IDMVMContext)object).getDMContext(), IExecutionDMContext.class);
}
}
}
return null;
}
}
@Override
protected Object getTarget(Object element) {
if (element instanceof IDMVMContext) {
return element;
}
return null;
}
@Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return true;
}
/**
* @return the currently active step type
*/
abstract StepType getStepType();
protected abstract StepType getStepType();
}

View file

@ -4,37 +4,40 @@
* 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.gdb.actions.IReverseResumeHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.core.commands.AbstractDebugCommand;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* @since 2.0
* Command performing a reverse resume.
*
* @since 2.1
*/
@Immutable
public class GdbReverseResumeCommand implements IReverseResumeHandler {
private final DsfExecutor fExecutor;
public class GdbReverseResumeCommand extends AbstractDebugCommand implements IReverseResumeHandler {
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
public GdbReverseResumeCommand(DsfSession session) {
@ -46,13 +49,52 @@ public class GdbReverseResumeCommand implements IReverseResumeHandler {
fTracker.dispose();
}
public boolean canReverseResume(ISelection debugContext) {
final IExecutionDMContext dmc = getContext(debugContext);
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
if (dmc == null) {
return false;
return;
}
Query<Object> reverseResume = new Query<Object>() {
@Override
public void execute(DataRequestMonitor<Object> rm) {
IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.reverseResume(dmc, rm);
} else {
rm.done();
}
}
};
try {
fExecutor.execute(reverseResume);
reverseResume.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
throws CoreException
{
if (targets.length != 1) {
return false;
}
final IExecutionDMContext dmc = DMContexts.getAncestorOfType(((IDMVMContext)targets[0]).getDMContext(), IExecutionDMContext.class);
if (dmc == null) {
return false;
}
Query<Boolean> canReverseResume = new Query<Boolean>() {
@Override
public void execute(DataRequestMonitor<Boolean> rm) {
@ -78,47 +120,16 @@ public class GdbReverseResumeCommand implements IReverseResumeHandler {
return false;
}
public void reverseResume(ISelection debugContext) {
final IExecutionDMContext dmc = getContext(debugContext);
if (dmc == null) {
return;
}
Query<Object> reverseResume = new Query<Object>() {
@Override
public void execute(DataRequestMonitor<Object> rm) {
IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.reverseResume(dmc, rm);
} else {
rm.setData(false);
rm.done();
}
}
};
try {
fExecutor.execute(reverseResume);
reverseResume.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
@Override
protected Object getTarget(Object element) {
if (element instanceof IDMVMContext) {
return element;
}
return null;
}
private IExecutionDMContext getContext(ISelection debugContext) {
if (debugContext instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) debugContext;
if (!ss.isEmpty()) {
Object object = ss.getFirstElement();
if (object instanceof IDMVMContext) {
return DMContexts.getAncestorOfType(((IDMVMContext)object).getDMContext(), IExecutionDMContext.class);
}
}
}
return null;
@Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return false;
}
}

View file

@ -4,44 +4,29 @@
* 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.ui.actions.DsfSteppingModeTarget;
import org.eclipse.cdt.dsf.gdb.actions.IReverseStepIntoHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* Command performing a reverse step into.
* @since 2.1
*/
@Immutable
public class GdbReverseStepIntoCommand extends GdbAbstractReverseStepCommand implements IReverseStepIntoHandler {
public GdbReverseStepIntoCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
super(session, steppingMode);
}
}
public boolean canReverseStepInto(ISelection debugContext) {
return canReverseStep(debugContext);
@Override
protected final StepType getStepType() {
boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_INTO : StepType.STEP_INTO;
}
public void reverseStepInto(ISelection debugContext) {
reverseStep(debugContext);
}
/**
* @return the currently active step type
*/
@Override
protected final StepType getStepType() {
boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_INTO : StepType.STEP_INTO;
}
}

View file

@ -4,44 +4,29 @@
* 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.ui.actions.DsfSteppingModeTarget;
import org.eclipse.cdt.dsf.gdb.actions.IReverseStepOverHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* Command performing a reverse step over
* @since 2.1
*/
@Immutable
public class GdbReverseStepOverCommand extends GdbAbstractReverseStepCommand implements IReverseStepOverHandler {
public GdbReverseStepOverCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
super(session, steppingMode);
}
public boolean canReverseStepOver(ISelection debugContext) {
return canReverseStep(debugContext);
}
public void reverseStepOver(ISelection debugContext) {
reverseStep(debugContext);
@Override
protected final StepType getStepType() {
boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_OVER : StepType.STEP_OVER;
}
/**
* @return the currently active step type
*/
@Override
protected final StepType getStepType() {
boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_OVER : StepType.STEP_OVER;
}
}

View file

@ -4,39 +4,43 @@
* 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.gdb.actions.IReverseToggleHandler;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.gdb.service.IReverseRunControl;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.core.commands.AbstractDebugCommand;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* @since 2.0
* Command that toggles the Reverse Debugging feature
*
* @since 2.1
*/
@Immutable
public class GdbReverseToggleCommand implements IReverseToggleHandler {
private final DsfExecutor fExecutor;
public class GdbReverseToggleCommand extends AbstractDebugCommand implements IReverseToggleHandler {
private final DsfExecutor fExecutor;
private final DsfServicesTracker fTracker;
public GdbReverseToggleCommand(DsfSession session) {
@ -48,10 +52,57 @@ public class GdbReverseToggleCommand implements IReverseToggleHandler {
fTracker.dispose();
}
public boolean canToggleReverse(ISelection debugContext) {
final ICommandControlDMContext controlDmc = getCommandControlContext(debugContext);
final IExecutionDMContext execDmc = getExecutionContext(debugContext);
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
if (targets.length != 1) {
return;
}
IDMContext dmc = ((IDMVMContext)targets[0]).getDMContext();
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
if (controlDmc == null) {
return;
}
Query<Object> setReverseMode = new Query<Object>() {
@Override
public void execute(final DataRequestMonitor<Object> rm) {
final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.isReverseModeEnabled(controlDmc,
new DataRequestMonitor<Boolean>(fExecutor, rm) {
@Override
public void handleSuccess() {
runControl.enableReverseMode(controlDmc, !getData(), rm);
}
});
} else {
rm.done();
}
}
};
try {
fExecutor.execute(setReverseMode);
setReverseMode.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
}
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
throws CoreException
{
if (targets.length != 1) {
return false;
}
IDMContext dmc = ((IDMVMContext)targets[0]).getDMContext();
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
final IExecutionDMContext execDmc = DMContexts.getAncestorOfType(dmc, IExecutionDMContext.class);
if (controlDmc == null && execDmc == null) {
return false;
}
@ -85,103 +136,61 @@ public class GdbReverseToggleCommand implements IReverseToggleHandler {
return false;
}
public void toggleReverse(ISelection debugContext) {
final ICommandControlDMContext dmc = getCommandControlContext(debugContext);
if (dmc == null) {
return;
}
Query<Object> setReverseMode = new Query<Object>() {
@Override
public void execute(final DataRequestMonitor<Object> rm) {
final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.isReverseModeEnabled(dmc,
new DataRequestMonitor<Boolean>(fExecutor, rm) {
@Override
public void handleSuccess() {
runControl.enableReverseMode(dmc, !getData(), rm);
}
});
} else {
rm.setData(false);
rm.done();
}
}
};
try {
fExecutor.execute(setReverseMode);
setReverseMode.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
@Override
protected Object getTarget(Object element) {
if (element instanceof IDMVMContext) {
return element;
}
return null;
}
private ICommandControlDMContext getCommandControlContext(ISelection debugContext) {
if (debugContext instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) debugContext;
if (!ss.isEmpty()) {
Object object = ss.getFirstElement();
if (object instanceof IDMVMContext) {
return DMContexts.getAncestorOfType(((IDMVMContext)object).getDMContext(), ICommandControlDMContext.class);
}
}
}
return null;
@Override
protected boolean isRemainEnabled(IDebugCommandRequest request) {
return true;
}
public boolean toggleNeedsUpdating() {
return true;
}
private IExecutionDMContext getExecutionContext(ISelection debugContext) {
if (debugContext instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) debugContext;
if (!ss.isEmpty()) {
Object object = ss.getFirstElement();
if (object instanceof IDMVMContext) {
return DMContexts.getAncestorOfType(((IDMVMContext)object).getDMContext(), IExecutionDMContext.class);
}
}
}
return null;
}
public boolean isReverseToggled(ISelection debugContext) {
final ICommandControlDMContext dmc = getCommandControlContext(debugContext);
return isReverseToggled(dmc);
}
public boolean isReverseToggled(final ICommandControlDMContext dmc) {
public boolean isReverseToggled(Object context) {
IDMContext dmc;
if (dmc == null) {
return false;
}
if (context instanceof IDMContext) {
dmc = (IDMContext)context;
} else if (context instanceof IDMVMContext) {
dmc = ((IDMVMContext)context).getDMContext();
} else {
return false;
}
Query<Boolean> isToggledQuery = new Query<Boolean>() {
@Override
public void execute(final DataRequestMonitor<Boolean> rm) {
final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
if (controlDmc == null) {
return false;
}
if (runControl != null) {
runControl.isReverseModeEnabled(dmc, rm);
} else {
rm.setData(false);
rm.done();
}
}
};
Query<Boolean> isToggledQuery = new Query<Boolean>() {
@Override
public void execute(final DataRequestMonitor<Boolean> rm) {
final IReverseRunControl runControl = fTracker.getService(IReverseRunControl.class);
if (runControl != null) {
runControl.isReverseModeEnabled(controlDmc, rm);
} else {
rm.setData(false);
rm.done();
}
}
};
try {
fExecutor.execute(isToggledQuery);
return isToggledQuery.get();
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
} catch (InterruptedException e) {
} catch (ExecutionException e) {
} catch (RejectedExecutionException e) {
// Can be thrown if the session is shutdown
}
return false;
}
return false;
}
}

View file

@ -4,44 +4,29 @@
* 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:
* Ericsson - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
package org.eclipse.cdt.dsf.gdb.internal.ui.commands;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.debug.core.model.IUncallHandler;
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.ui.actions.DsfSteppingModeTarget;
import org.eclipse.cdt.dsf.gdb.actions.IUncallHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* Command performing an uncall operation (part of Reverse Debugging).
* @since 2.1
*/
@Immutable
public class GdbUncallCommand extends GdbAbstractReverseStepCommand implements IUncallHandler {
public GdbUncallCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
public GdbUncallCommand(DsfSession session, DsfSteppingModeTarget steppingMode) {
super(session, steppingMode);
}
public boolean canUncall(ISelection debugContext) {
return canReverseStep(debugContext);
}
public void uncall(ISelection debugContext) {
reverseStep(debugContext);
}
/**
* @return the currently active step type
*/
@Override
protected final StepType getStepType() {
boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_RETURN : StepType.STEP_RETURN;
}
}
@Override
protected final StepType getStepType() {
boolean instructionSteppingEnabled = getSteppingMode() != null && getSteppingMode().isInstructionSteppingEnabled();
return instructionSteppingEnabled ? StepType.INSTRUCTION_STEP_RETURN : StepType.STEP_RETURN;
}
}

View file

@ -14,7 +14,10 @@ import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* @deprecated This interface was synchronous. I has been replaced with the asynchronous
* interface @{link org.eclipse.cdt.debug.core.model.IReverseResumeHandler}
*/
@Deprecated
public interface IReverseResumeHandler {
public boolean canReverseResume(ISelection debugContext);
public void reverseResume(ISelection debugContext);

View file

@ -14,7 +14,10 @@ import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* @deprecated This interface was synchronous. I has been replaced with the asynchronous
* interface @{link org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler}
*/
@Deprecated
public interface IReverseStepIntoHandler {
public boolean canReverseStepInto(ISelection debugContext);
public void reverseStepInto(ISelection debugContext);

View file

@ -14,7 +14,10 @@ import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* @deprecated This interface was synchronous. I has been replaced with the asynchronous
* interface @{link org.eclipse.cdt.debug.core.model.IReverseStepOverHandler}
*/
@Deprecated
public interface IReverseStepOverHandler {
public boolean canReverseStepOver(ISelection debugContext);
public void reverseStepOver(ISelection debugContext);

View file

@ -15,7 +15,10 @@ import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* @deprecated This interface was synchronous. I has been replaced with the asynchronous
* interface @{link org.eclipse.cdt.debug.core.model.IReverseToggleHandler}
*/
@Deprecated
public interface IReverseToggleHandler {
public boolean canToggleReverse(ISelection debugContext);
public void toggleReverse(ISelection debugContext);

View file

@ -14,7 +14,10 @@ import org.eclipse.jface.viewers.ISelection;
/**
* @since 2.0
* @deprecated This interface was synchronous. I has been replaced with the asynchronous
* interface @{link org.eclipse.cdt.debug.core.model.IUncallHandler}
*/
@Deprecated
public interface IUncallHandler {
public boolean canUncall(ISelection debugContext);
public void uncall(ISelection debugContext);