mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Added the "Instruction Stepping Mode" action.
This commit is contained in:
parent
64e6bbf48d
commit
4debf40704
7 changed files with 232 additions and 40 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-05-13 Mikhail Khodjaiants
|
||||
Added the "Instruction Stepping Mode" action.
|
||||
* ToggleInstructionStepModeActionDelegate.java
|
||||
* plugin.properties
|
||||
* plugin.xml
|
||||
* org.eclipse.cdt.debug.ui/icons/full/clcl16/instr_step.gif: new
|
||||
* org.eclipse.cdt.debug.ui/icons/full/dlcl16/instr_step.gif: new
|
||||
* org.eclipse.cdt.debug.ui/icons/full/elcl16/instr_step.gif: new
|
||||
|
||||
2004-05-12 Mikhail Khodjaiants
|
||||
The input member of 'DisassemblyAnnotationModel' can be null.
|
||||
* DisassemblyAnnotationModel.java
|
||||
|
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/instr_step.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/instr_step.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 108 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/instr_step.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/instr_step.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 76 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/instr_step.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/instr_step.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 199 B |
|
@ -22,6 +22,9 @@ DebugActionSet.label=C/C++ Debug
|
|||
RestartAction.label=Restart
|
||||
RestartAction.tooltip=Restart
|
||||
|
||||
ToggleInstructionStepModeAction.label=Instruction Stepping Mode
|
||||
ToggleInstructionStepModeAction.tooltip=Instruction Stepping Mode
|
||||
|
||||
SwitchToDisassemblyAction.label=Disassembly Mode
|
||||
SwitchToDisassemblyAction.tooltip=Disassembly Mode On/Off
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@
|
|||
<view
|
||||
relative="org.eclipse.debug.ui.VariableView"
|
||||
visible="false"
|
||||
relationship="stack"
|
||||
id="org.eclipse.cdt.debug.ui.MemoryView">
|
||||
id="org.eclipse.cdt.debug.ui.MemoryView"
|
||||
relationship="stack">
|
||||
</view>
|
||||
<viewShortcut
|
||||
id="org.eclipse.cdt.debug.ui.MemoryView">
|
||||
|
@ -85,8 +85,8 @@
|
|||
<view
|
||||
relative="org.eclipse.debug.ui.VariableView"
|
||||
visible="false"
|
||||
relationship="stack"
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibrariesView"
|
||||
relationship="stack">
|
||||
</view>
|
||||
<viewShortcut
|
||||
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
|
||||
|
@ -94,8 +94,8 @@
|
|||
<view
|
||||
relative="org.eclipse.debug.ui.VariableView"
|
||||
visible="false"
|
||||
relationship="stack"
|
||||
id="org.eclipse.cdt.debug.ui.SignalsView">
|
||||
id="org.eclipse.cdt.debug.ui.SignalsView"
|
||||
relationship="stack">
|
||||
</view>
|
||||
<viewShortcut
|
||||
id="org.eclipse.cdt.debug.ui.SignalsView">
|
||||
|
@ -106,8 +106,8 @@
|
|||
<view
|
||||
relative="org.eclipse.ui.views.ContentOutline"
|
||||
visible="false"
|
||||
relationship="stack"
|
||||
id="org.eclipse.cdt.debug.ui.DisassemblyView">
|
||||
id="org.eclipse.cdt.debug.ui.DisassemblyView"
|
||||
relationship="stack">
|
||||
</view>
|
||||
<viewShortcut
|
||||
id="org.eclipse.cdt.debug.ui.DisassemblyView">
|
||||
|
@ -279,8 +279,8 @@
|
|||
</action>
|
||||
<action
|
||||
label="%SwitchToDisassemblyAction.label"
|
||||
style="toggle"
|
||||
icon="icons/full/clcl16/disassembly.gif"
|
||||
style="toggle"
|
||||
helpContextId="switch_to_disassembly_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
|
||||
menubarPath="renderGroup"
|
||||
|
@ -293,6 +293,24 @@
|
|||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
state="false"
|
||||
style="toggle"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
enablesFor="1"
|
||||
icon="icons/full/clcl16/instr_step.gif"
|
||||
helpContextId="toggle_instruction_step_mode_action_context"
|
||||
label="%ToggleInstructionStepModeAction.label"
|
||||
menubarPath="renderGroup"
|
||||
tooltip="%ToggleInstructionStepModeAction.tooltip">
|
||||
<enablement>
|
||||
<pluginState
|
||||
id="org.eclipse.cdt.debug.ui"
|
||||
value="activated">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewerContribution>
|
||||
<viewerContribution
|
||||
targetID="#CEditorRulerContext"
|
||||
|
@ -675,8 +693,8 @@
|
|||
label="%LoadSymbolsAction.label"
|
||||
icon="icons/full/clcl16/load_symbols_co.gif"
|
||||
helpContextId="load_symbols_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
|
||||
tooltip="%LoadSymbolsAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
|
||||
menubarPath="sharedLibrariesGroup"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate">
|
||||
|
@ -695,8 +713,8 @@
|
|||
label="%SignalAction.label"
|
||||
icon="icons/full/clcl16/signal_co.gif"
|
||||
helpContextId="signal_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
|
||||
tooltip="%SignalAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate">
|
||||
|
@ -711,8 +729,8 @@
|
|||
label="%SignalPropertiesAction.label"
|
||||
style="pulldown"
|
||||
helpContextId="signal_properties_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
|
||||
tooltip="%SignalPropertiesAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.ui.SignalPropertiesAction">
|
||||
<enablement>
|
||||
|
@ -748,8 +766,8 @@
|
|||
<action
|
||||
label="%RestoreDefaultTypeAction.label"
|
||||
helpContextId="restore_default_type_action_context"
|
||||
tooltip="%RestoreDefaultTypeAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
|
||||
tooltip="%RestoreDefaultTypeAction.tooltip"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate">
|
||||
|
@ -764,8 +782,8 @@
|
|||
label="%CastToTypeAction.label"
|
||||
icon="icons/full/clcl16/casttotype_co.gif"
|
||||
helpContextId="cast_to_type_action_context"
|
||||
tooltip="%CastToTypeAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
|
||||
tooltip="%CastToTypeAction.tooltip"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate">
|
||||
|
@ -780,8 +798,8 @@
|
|||
label="%CastToArrayAction.label"
|
||||
icon="icons/full/clcl16/showasarray_co.gif"
|
||||
helpContextId="cast_to_array_action_context"
|
||||
tooltip="%CastToArrayAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
|
||||
tooltip="%CastToArrayAction.tooltip"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate">
|
||||
|
@ -800,8 +818,8 @@
|
|||
label="%ManageFunctionBreakpointAction.label"
|
||||
icon="icons/full/obj16/funbrkp_obj.gif"
|
||||
helpContextId="manage_function_breakpoint_action_context"
|
||||
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
|
||||
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
||||
menubarPath="additions"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate">
|
||||
|
@ -820,8 +838,8 @@
|
|||
label="%DisableVariablesAction.label"
|
||||
icon="icons/full/clcl16/disabled_co.gif"
|
||||
helpContextId="disable_variables_action_context"
|
||||
tooltip="%DisableVariablesAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
|
||||
tooltip="%DisableVariablesAction.tooltip"
|
||||
menubarPath="variableGroup"
|
||||
enablesFor="2+"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate">
|
||||
|
@ -833,8 +851,8 @@
|
|||
label="%EnableVariablesAction.label"
|
||||
icon="icons/full/clcl16/enabled_co.gif"
|
||||
helpContextId="enable_variables_action_context"
|
||||
tooltip="%EnableVariablesAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
|
||||
tooltip="%EnableVariablesAction.tooltip"
|
||||
menubarPath="variableGroup"
|
||||
enablesFor="2+"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate">
|
||||
|
@ -857,8 +875,8 @@
|
|||
disabledIcon="icons/full/dlcl16/restart.gif"
|
||||
enablesFor="1"
|
||||
icon="icons/full/elcl16/restart.gif"
|
||||
helpContextId="restart_action_context"
|
||||
label="%RestartAction.label"
|
||||
helpContextId="restart_action_context"
|
||||
tooltip="%RestartAction.tooltip">
|
||||
<enablement>
|
||||
<pluginState
|
||||
|
@ -876,8 +894,8 @@
|
|||
disabledIcon="icons/full/dlcl16/disassembly.gif"
|
||||
enablesFor="1"
|
||||
icon="icons/full/elcl16/disassembly.gif"
|
||||
helpContextId="switch_to_disassembly_action_context"
|
||||
label="%SwitchToDisassemblyAction.label"
|
||||
helpContextId="switch_to_disassembly_action_context"
|
||||
tooltip="%SwitchToDisassemblyAction.tooltip">
|
||||
<enablement>
|
||||
<pluginState
|
||||
|
@ -886,17 +904,37 @@
|
|||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
style="toggle"
|
||||
state="false"
|
||||
toolbarPath="renderGroup"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
hoverIcon="icons/full/clcl16/instr_step.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
|
||||
disabledIcon="icons/full/dlcl16/instr_step.gif"
|
||||
enablesFor="1"
|
||||
icon="icons/full/elcl16/instr_step.gif"
|
||||
helpContextId="toggle_instruction_step_mode_action_context"
|
||||
label="%ToggleInstructionStepModeAction.label"
|
||||
tooltip="%ToggleInstructionStepModeAction.tooltip">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewContribution>
|
||||
<viewContribution
|
||||
targetID="org.eclipse.debug.ui.DebugView"
|
||||
id="org.eclipse.cdt.debug.ui.debugView.menu">
|
||||
<action
|
||||
label="%ShowFullPathsAction.label"
|
||||
icon="icons/full/clcl16/show_paths.gif"
|
||||
style="toggle"
|
||||
icon="icons/full/clcl16/show_paths.gif"
|
||||
helpContextId="show_full_paths_context"
|
||||
tooltip="%ShowFullPathsAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
tooltip="%ShowFullPathsAction.tooltip"
|
||||
menubarPath="cDebugActions"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
|
||||
<enablement>
|
||||
|
@ -916,11 +954,11 @@
|
|||
id="org.eclipse.cdt.debug.ui.breakpointView.menu">
|
||||
<action
|
||||
label="%ShowFullPathsAction.label"
|
||||
icon="icons/full/clcl16/show_paths.gif"
|
||||
style="toggle"
|
||||
icon="icons/full/clcl16/show_paths.gif"
|
||||
helpContextId="show_full_paths_context"
|
||||
tooltip="%ShowFullPathsAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
tooltip="%ShowFullPathsAction.tooltip"
|
||||
menubarPath="cDebugActions"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
|
||||
<enablement>
|
||||
|
@ -942,8 +980,8 @@
|
|||
disabledIcon="icons/full/dlcl16/watch_globals.gif"
|
||||
enablesFor="1"
|
||||
icon="icons/full/elcl16/watch_globals.gif"
|
||||
helpContextId="add_globals_action_context"
|
||||
label="%AddGlobalsAction.label"
|
||||
helpContextId="add_globals_action_context"
|
||||
tooltip="%AddGlobalsAction.tooltip">
|
||||
<enablement>
|
||||
<pluginState
|
||||
|
@ -958,11 +996,11 @@
|
|||
id="org.eclipse.debug.ui.sharedLibrariesView.menu">
|
||||
<action
|
||||
label="%ShowFullPathsAction.label"
|
||||
style="toggle"
|
||||
icon="icons/full/clcl16/show_paths.gif"
|
||||
style="toggle"
|
||||
helpContextId="show_full_paths_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
tooltip="%ShowFullPathsAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
menubarPath="cDebugActions"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
|
||||
<enablement>
|
||||
|
@ -1053,20 +1091,20 @@
|
|||
<extension
|
||||
point="org.eclipse.debug.core.statusHandlers">
|
||||
<statusHandler
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
code="10000"
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
class="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler"
|
||||
id="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler">
|
||||
</statusHandler>
|
||||
<statusHandler
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
code="10001"
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
class="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler"
|
||||
id="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler">
|
||||
</statusHandler>
|
||||
<statusHandler
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
code="10002"
|
||||
plugin="org.eclipse.cdt.debug.core"
|
||||
class="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler"
|
||||
id="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler">
|
||||
</statusHandler>
|
||||
|
@ -1123,16 +1161,16 @@
|
|||
point="org.eclipse.ui.editors">
|
||||
<editor
|
||||
name="%DisassemblyEditor.name"
|
||||
icon="icons/full/obj16/disassembly_obj.gif"
|
||||
extensions="dasm"
|
||||
icon="icons/full/obj16/disassembly_obj.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor"
|
||||
id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
|
||||
</editor>
|
||||
<editor
|
||||
name="%CDebugEditor.name"
|
||||
icon="icons/full/obj16/filenotfound_obj.gif"
|
||||
contributorClass="org.eclipse.cdt.internal.ui.editor.CEditorActionContributor"
|
||||
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor"
|
||||
contributorClass="org.eclipse.cdt.internal.ui.editor.CEditorActionContributor"
|
||||
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
|
||||
</editor>
|
||||
</extension>
|
||||
|
@ -1154,8 +1192,8 @@
|
|||
<context
|
||||
name="Debugging C/C++"
|
||||
description="Debugging C/C++ Programs"
|
||||
parentId="org.eclipse.debug.ui.debugging"
|
||||
id="org.eclipse.cdt.debug.ui.debugging">
|
||||
id="org.eclipse.cdt.debug.ui.debugging"
|
||||
parentId="org.eclipse.debug.ui.debugging">
|
||||
</context>
|
||||
</extension>
|
||||
<extension
|
||||
|
@ -1187,8 +1225,8 @@
|
|||
<extension
|
||||
point="org.eclipse.ui.editors.annotationTypes">
|
||||
<type
|
||||
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"
|
||||
super="org.eclipse.debug.core.breakpoint"
|
||||
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"
|
||||
name="org.eclipse.cdt.debug.core.breakpoint">
|
||||
</type>
|
||||
<type
|
||||
|
@ -1217,8 +1255,8 @@
|
|||
highlightPreferenceValue="true"
|
||||
presentationLayer="6"
|
||||
icon="icons/full/obj16/inst_ptr_top.gif"
|
||||
label="%DisassemblyCurrentInstructionPointer"
|
||||
textPreferenceValue="false"
|
||||
label="%DisassemblyCurrentInstructionPointer"
|
||||
textPreferenceKey="currentDisassemblyIPIndication"
|
||||
verticalRulerPreferenceKey="currentDisassemblyIPVerticalRuler"
|
||||
overviewRulerPreferenceKey="currentDisassemblyIPOverviewRuler">
|
||||
|
@ -1233,8 +1271,8 @@
|
|||
highlightPreferenceValue="true"
|
||||
presentationLayer="6"
|
||||
icon="icons/full/obj16/inst_ptr.gif"
|
||||
label="%DisassemblySecondaryInstructionPointer"
|
||||
textPreferenceValue="false"
|
||||
label="%DisassemblySecondaryInstructionPointer"
|
||||
textPreferenceKey="secondaryDisassemblyIPIndication"
|
||||
verticalRulerPreferenceKey="secondaryDisassemblyIPVerticalRuler"
|
||||
overviewRulerPreferenceKey="secondaryDisassemblyIPOverviewRuler">
|
||||
|
@ -1281,17 +1319,21 @@
|
|||
</themeElementCategory>
|
||||
<colorDefinition
|
||||
label="%DisassemblySourceLineColor.label"
|
||||
categoryId="org.eclipse.cdt.debug.ui.presentation"
|
||||
value="COLOR_DARK_BLUE"
|
||||
categoryId="org.eclipse.cdt.debug.ui.presentation"
|
||||
id="org.eclipse.cdt.debug.ui.disassembly.sourceLineColor">
|
||||
<description>%DisassemblySourceLineColor.description</description>
|
||||
<description>
|
||||
%DisassemblySourceLineColor.description
|
||||
</description>
|
||||
</colorDefinition>
|
||||
<fontDefinition
|
||||
label="%DisassemblyFontDefinition.label"
|
||||
categoryId="org.eclipse.cdt.debug.ui.presentation"
|
||||
defaultsTo="org.eclipse.jface.textfont"
|
||||
id="org.eclipse.cdt.debug.ui.disassemblyFont">
|
||||
<description>%DisassemblyFontDefinition.description</description>
|
||||
<description>
|
||||
%DisassemblyFontDefinition.description
|
||||
</description>
|
||||
</fontDefinition>
|
||||
</extension>
|
||||
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
|
||||
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.ui.IViewActionDelegate;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
/**
|
||||
* Turns instruction step mode on/off for selected target.
|
||||
*/
|
||||
public class ToggleInstructionStepModeActionDelegate extends ActionDelegate implements IViewActionDelegate, IPropertyChangeListener {
|
||||
|
||||
private ICDebugTarget fTarget = null;
|
||||
|
||||
private IAction fAction = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
|
||||
*/
|
||||
public void propertyChange( PropertyChangeEvent event ) {
|
||||
IAction action = getAction();
|
||||
if ( action != null ) {
|
||||
if ( event.getNewValue() instanceof Boolean ) {
|
||||
boolean value = ((Boolean)event.getNewValue()).booleanValue();
|
||||
if ( value != action.isChecked() )
|
||||
action.setChecked( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
|
||||
*/
|
||||
public void init( IViewPart view ) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate2#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
ICDebugTarget target = getTarget();
|
||||
if ( target != null )
|
||||
target.removePropertyChangeListener( this );
|
||||
setTarget( null );
|
||||
setAction( null );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void init( IAction action ) {
|
||||
setAction( action );
|
||||
action.setChecked( false );
|
||||
action.setEnabled( false );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void run( IAction action ) {
|
||||
ICDebugTarget target = getTarget();
|
||||
if ( target != null ) {
|
||||
target.enableInstructionStepping( getAction().isChecked() );
|
||||
}
|
||||
}
|
||||
|
||||
/* (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 selection ) {
|
||||
ICDebugTarget newTarget = null;
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
newTarget = getTargetFromSelection( ((IStructuredSelection)selection).getFirstElement() );
|
||||
}
|
||||
ICDebugTarget oldTarget = getTarget();
|
||||
if ( oldTarget != null && !oldTarget.equals( newTarget ) ) {
|
||||
oldTarget.removePropertyChangeListener( this );
|
||||
setTarget( null );
|
||||
action.setChecked( false );
|
||||
}
|
||||
if ( newTarget != null && !newTarget.isTerminated() && !newTarget.isDisconnected() ) {
|
||||
setTarget( newTarget );
|
||||
newTarget.addPropertyChangeListener( this );
|
||||
action.setChecked( newTarget.isInstructionSteppingEnabled() );
|
||||
}
|
||||
action.setEnabled( newTarget != null && newTarget.supportsInstructionStepping()
|
||||
&& !newTarget.isTerminated() && !newTarget.isDisconnected() );
|
||||
}
|
||||
|
||||
private ICDebugTarget getTarget() {
|
||||
return this.fTarget;
|
||||
}
|
||||
|
||||
private void setTarget( ICDebugTarget target ) {
|
||||
this.fTarget = target;
|
||||
}
|
||||
|
||||
private IAction getAction() {
|
||||
return this.fAction;
|
||||
}
|
||||
|
||||
private void setAction( IAction action ) {
|
||||
this.fAction = action;
|
||||
}
|
||||
|
||||
private ICDebugTarget getTargetFromSelection( Object element ) {
|
||||
if ( element instanceof IDebugElement ) {
|
||||
IDebugTarget target = ((IDebugElement)element).getDebugTarget();
|
||||
return ( target instanceof ICDebugTarget ) ? (ICDebugTarget)target : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue