1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Implementing retargettable actions for Disassembly view.

This commit is contained in:
Mikhail Khodjaiants 2004-04-16 21:45:24 +00:00
parent a2189ff379
commit ce956c49b8
8 changed files with 180 additions and 83 deletions

View file

@ -1,3 +1,13 @@
2004-04-16 Mikhail Khodjaiants
Implementing retargettable actions for Disassembly view.
* plugin.xml
* DisassemblyView.java: new
* DisassemblyEditorInput.java
* BreakpointLocationVerifier.java
* ActionMessages.properties
* RunToLineAdapter.java
* ToggleBreakpointAdapter.java
2004-04-15 Mikhail Khodjaiants 2004-04-15 Mikhail Khodjaiants
Implementing the Disassembly view. Implementing the Disassembly view.
New pacckage: org.eclipse.cdt.debug.internal.ui.views.disassembly New pacckage: org.eclipse.cdt.debug.internal.ui.views.disassembly

View file

@ -87,8 +87,8 @@
<view <view
relative="org.eclipse.debug.ui.VariableView" relative="org.eclipse.debug.ui.VariableView"
visible="false" visible="false"
relationship="stack" id="org.eclipse.cdt.debug.ui.MemoryView"
id="org.eclipse.cdt.debug.ui.MemoryView"> relationship="stack">
</view> </view>
<viewShortcut <viewShortcut
id="org.eclipse.cdt.debug.ui.MemoryView"> id="org.eclipse.cdt.debug.ui.MemoryView">
@ -96,8 +96,8 @@
<view <view
relative="org.eclipse.debug.ui.VariableView" relative="org.eclipse.debug.ui.VariableView"
visible="false" visible="false"
relationship="stack" id="org.eclipse.cdt.debug.ui.SharedLibrariesView"
id="org.eclipse.cdt.debug.ui.SharedLibrariesView"> relationship="stack">
</view> </view>
<viewShortcut <viewShortcut
id="org.eclipse.cdt.debug.ui.SharedLibrariesView"> id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
@ -105,8 +105,8 @@
<view <view
relative="org.eclipse.debug.ui.VariableView" relative="org.eclipse.debug.ui.VariableView"
visible="false" visible="false"
relationship="stack" id="org.eclipse.cdt.debug.ui.SignalsView"
id="org.eclipse.cdt.debug.ui.SignalsView"> relationship="stack">
</view> </view>
<viewShortcut <viewShortcut
id="org.eclipse.cdt.debug.ui.SignalsView"> id="org.eclipse.cdt.debug.ui.SignalsView">
@ -117,8 +117,8 @@
<view <view
relative="org.eclipse.ui.views.ContentOutline" relative="org.eclipse.ui.views.ContentOutline"
visible="false" visible="false"
relationship="stack" id="org.eclipse.cdt.debug.ui.DisassemblyView"
id="org.eclipse.cdt.debug.ui.DisassemblyView"> relationship="stack">
</view> </view>
<viewShortcut <viewShortcut
id="org.eclipse.cdt.debug.ui.DisassemblyView"> id="org.eclipse.cdt.debug.ui.DisassemblyView">
@ -290,8 +290,8 @@
</action> </action>
<action <action
label="%SwitchToDisassemblyAction.label" label="%SwitchToDisassemblyAction.label"
style="toggle"
icon="icons/full/clcl16/disassembly.gif" icon="icons/full/clcl16/disassembly.gif"
style="toggle"
helpContextId="switch_to_disassembly_action_context" helpContextId="switch_to_disassembly_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
menubarPath="renderGroup" menubarPath="renderGroup"
@ -686,8 +686,8 @@
label="%LoadSymbolsAction.label" label="%LoadSymbolsAction.label"
icon="icons/full/clcl16/load_symbols_co.gif" icon="icons/full/clcl16/load_symbols_co.gif"
helpContextId="load_symbols_action_context" helpContextId="load_symbols_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
tooltip="%LoadSymbolsAction.tooltip" tooltip="%LoadSymbolsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
menubarPath="sharedLibrariesGroup" menubarPath="sharedLibrariesGroup"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate">
@ -706,8 +706,8 @@
label="%SignalAction.label" label="%SignalAction.label"
icon="icons/full/clcl16/signal_co.gif" icon="icons/full/clcl16/signal_co.gif"
helpContextId="signal_action_context" helpContextId="signal_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
tooltip="%SignalAction.tooltip" tooltip="%SignalAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
menubarPath="additions" menubarPath="additions"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate">
@ -722,8 +722,8 @@
label="%SignalPropertiesAction.label" label="%SignalPropertiesAction.label"
style="pulldown" style="pulldown"
helpContextId="signal_properties_action_context" helpContextId="signal_properties_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
tooltip="%SignalPropertiesAction.tooltip" tooltip="%SignalPropertiesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.ui.SignalPropertiesAction"> id="org.eclipse.cdt.debug.ui.SignalPropertiesAction">
<enablement> <enablement>
@ -759,8 +759,8 @@
<action <action
label="%RestoreDefaultTypeAction.label" label="%RestoreDefaultTypeAction.label"
helpContextId="restore_default_type_action_context" helpContextId="restore_default_type_action_context"
tooltip="%RestoreDefaultTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
tooltip="%RestoreDefaultTypeAction.tooltip"
menubarPath="additions" menubarPath="additions"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate">
@ -775,8 +775,8 @@
label="%CastToTypeAction.label" label="%CastToTypeAction.label"
icon="icons/full/clcl16/casttotype_co.gif" icon="icons/full/clcl16/casttotype_co.gif"
helpContextId="cast_to_type_action_context" helpContextId="cast_to_type_action_context"
tooltip="%CastToTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
tooltip="%CastToTypeAction.tooltip"
menubarPath="additions" menubarPath="additions"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate">
@ -791,8 +791,8 @@
label="%CastToArrayAction.label" label="%CastToArrayAction.label"
icon="icons/full/clcl16/showasarray_co.gif" icon="icons/full/clcl16/showasarray_co.gif"
helpContextId="cast_to_array_action_context" helpContextId="cast_to_array_action_context"
tooltip="%CastToArrayAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
tooltip="%CastToArrayAction.tooltip"
menubarPath="additions" menubarPath="additions"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate">
@ -811,8 +811,8 @@
label="%ManageFunctionBreakpointAction.label" label="%ManageFunctionBreakpointAction.label"
icon="icons/full/obj16/funbrkp_obj.gif" icon="icons/full/obj16/funbrkp_obj.gif"
helpContextId="manage_function_breakpoint_action_context" helpContextId="manage_function_breakpoint_action_context"
tooltip="%ManageFunctionBreakpointAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
tooltip="%ManageFunctionBreakpointAction.tooltip"
menubarPath="additions" menubarPath="additions"
enablesFor="1" enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate">
@ -831,8 +831,8 @@
label="%DisableVariablesAction.label" label="%DisableVariablesAction.label"
icon="icons/full/clcl16/disabled_co.gif" icon="icons/full/clcl16/disabled_co.gif"
helpContextId="disable_variables_action_context" helpContextId="disable_variables_action_context"
tooltip="%DisableVariablesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
tooltip="%DisableVariablesAction.tooltip"
menubarPath="variableGroup" menubarPath="variableGroup"
enablesFor="2+" enablesFor="2+"
id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate">
@ -844,8 +844,8 @@
label="%EnableVariablesAction.label" label="%EnableVariablesAction.label"
icon="icons/full/clcl16/enabled_co.gif" icon="icons/full/clcl16/enabled_co.gif"
helpContextId="enable_variables_action_context" helpContextId="enable_variables_action_context"
tooltip="%EnableVariablesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate" class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
tooltip="%EnableVariablesAction.tooltip"
menubarPath="variableGroup" menubarPath="variableGroup"
enablesFor="2+" enablesFor="2+"
id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"> id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate">
@ -868,8 +868,8 @@
disabledIcon="icons/full/dlcl16/restart.gif" disabledIcon="icons/full/dlcl16/restart.gif"
enablesFor="1" enablesFor="1"
icon="icons/full/elcl16/restart.gif" icon="icons/full/elcl16/restart.gif"
helpContextId="restart_action_context"
label="%RestartAction.label" label="%RestartAction.label"
helpContextId="restart_action_context"
tooltip="%RestartAction.tooltip"> tooltip="%RestartAction.tooltip">
<enablement> <enablement>
<pluginState <pluginState
@ -887,8 +887,8 @@
disabledIcon="icons/full/dlcl16/disassembly.gif" disabledIcon="icons/full/dlcl16/disassembly.gif"
enablesFor="1" enablesFor="1"
icon="icons/full/elcl16/disassembly.gif" icon="icons/full/elcl16/disassembly.gif"
helpContextId="switch_to_disassembly_action_context"
label="%SwitchToDisassemblyAction.label" label="%SwitchToDisassemblyAction.label"
helpContextId="switch_to_disassembly_action_context"
tooltip="%SwitchToDisassemblyAction.tooltip"> tooltip="%SwitchToDisassemblyAction.tooltip">
<enablement> <enablement>
<pluginState <pluginState
@ -903,11 +903,11 @@
id="org.eclipse.cdt.debug.ui.debugView.menu"> id="org.eclipse.cdt.debug.ui.debugView.menu">
<action <action
label="%ShowFullPathsAction.label" label="%ShowFullPathsAction.label"
icon="icons/full/clcl16/show_paths.gif"
style="toggle" style="toggle"
icon="icons/full/clcl16/show_paths.gif"
helpContextId="show_full_paths_context" helpContextId="show_full_paths_context"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction" class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
menubarPath="cDebugActions" menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"> id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement> <enablement>
@ -927,11 +927,11 @@
id="org.eclipse.cdt.debug.ui.breakpointView.menu"> id="org.eclipse.cdt.debug.ui.breakpointView.menu">
<action <action
label="%ShowFullPathsAction.label" label="%ShowFullPathsAction.label"
icon="icons/full/clcl16/show_paths.gif"
style="toggle" style="toggle"
icon="icons/full/clcl16/show_paths.gif"
helpContextId="show_full_paths_context" helpContextId="show_full_paths_context"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction" class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
menubarPath="cDebugActions" menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"> id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement> <enablement>
@ -953,8 +953,8 @@
disabledIcon="icons/full/dlcl16/watch_globals.gif" disabledIcon="icons/full/dlcl16/watch_globals.gif"
enablesFor="1" enablesFor="1"
icon="icons/full/elcl16/watch_globals.gif" icon="icons/full/elcl16/watch_globals.gif"
helpContextId="add_globals_action_context"
label="%AddGlobalsAction.label" label="%AddGlobalsAction.label"
helpContextId="add_globals_action_context"
tooltip="%AddGlobalsAction.tooltip"> tooltip="%AddGlobalsAction.tooltip">
<enablement> <enablement>
<pluginState <pluginState
@ -969,11 +969,11 @@
id="org.eclipse.debug.ui.sharedLibrariesView.menu"> id="org.eclipse.debug.ui.sharedLibrariesView.menu">
<action <action
label="%ShowFullPathsAction.label" label="%ShowFullPathsAction.label"
style="toggle"
icon="icons/full/clcl16/show_paths.gif" icon="icons/full/clcl16/show_paths.gif"
style="toggle"
helpContextId="show_full_paths_context" helpContextId="show_full_paths_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip" tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="cDebugActions" menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"> id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement> <enablement>
@ -1064,20 +1064,20 @@
<extension <extension
point="org.eclipse.debug.core.statusHandlers"> point="org.eclipse.debug.core.statusHandlers">
<statusHandler <statusHandler
plugin="org.eclipse.cdt.debug.core"
code="10000" code="10000"
plugin="org.eclipse.cdt.debug.core"
class="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler" class="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler"> id="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler">
</statusHandler> </statusHandler>
<statusHandler <statusHandler
plugin="org.eclipse.cdt.debug.core"
code="10001" code="10001"
plugin="org.eclipse.cdt.debug.core"
class="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler" class="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler"> id="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler">
</statusHandler> </statusHandler>
<statusHandler <statusHandler
plugin="org.eclipse.cdt.debug.core"
code="10002" code="10002"
plugin="org.eclipse.cdt.debug.core"
class="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler" class="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler"> id="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler">
</statusHandler> </statusHandler>
@ -1134,16 +1134,16 @@
point="org.eclipse.ui.editors"> point="org.eclipse.ui.editors">
<editor <editor
name="%DisassemblyEditor.name" name="%DisassemblyEditor.name"
icon="icons/full/obj16/disassembly_obj.gif"
extensions="dasm" extensions="dasm"
icon="icons/full/obj16/disassembly_obj.gif"
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor" class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor"
id="org.eclipse.cdt.debug.ui.DisassemblyEditor"> id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
</editor> </editor>
<editor <editor
name="%CDebugEditor.name" name="%CDebugEditor.name"
icon="icons/full/obj16/filenotfound_obj.gif" icon="icons/full/obj16/filenotfound_obj.gif"
contributorClass="org.eclipse.cdt.internal.ui.editor.CEditorActionContributor"
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor" 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"> id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
</editor> </editor>
</extension> </extension>
@ -1165,8 +1165,8 @@
<context <context
name="Debugging C/C++" name="Debugging C/C++"
description="Debugging C/C++ Programs" 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> </context>
</extension> </extension>
<extension <extension
@ -1198,8 +1198,8 @@
<extension <extension
point="org.eclipse.ui.editors.annotationTypes"> point="org.eclipse.ui.editors.annotationTypes">
<type <type
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"
super="org.eclipse.debug.core.breakpoint" super="org.eclipse.debug.core.breakpoint"
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"
name="org.eclipse.cdt.debug.core.breakpoint"> name="org.eclipse.cdt.debug.core.breakpoint">
</type> </type>
<type <type
@ -1228,8 +1228,8 @@
highlightPreferenceValue="true" highlightPreferenceValue="true"
presentationLayer="6" presentationLayer="6"
icon="icons/full/obj16/inst_ptr_top.gif" icon="icons/full/obj16/inst_ptr_top.gif"
label="%DisassemblyCurrentInstructionPointer"
textPreferenceValue="false" textPreferenceValue="false"
label="%DisassemblyCurrentInstructionPointer"
textPreferenceKey="currentDisassemblyIPIndication" textPreferenceKey="currentDisassemblyIPIndication"
verticalRulerPreferenceKey="currentDisassemblyIPVerticalRuler" verticalRulerPreferenceKey="currentDisassemblyIPVerticalRuler"
overviewRulerPreferenceKey="currentDisassemblyIPOverviewRuler"> overviewRulerPreferenceKey="currentDisassemblyIPOverviewRuler">
@ -1244,8 +1244,8 @@
highlightPreferenceValue="true" highlightPreferenceValue="true"
presentationLayer="6" presentationLayer="6"
icon="icons/full/obj16/inst_ptr.gif" icon="icons/full/obj16/inst_ptr.gif"
label="%DisassemblySecondaryInstructionPointer"
textPreferenceValue="false" textPreferenceValue="false"
label="%DisassemblySecondaryInstructionPointer"
textPreferenceKey="secondaryDisassemblyIPIndication" textPreferenceKey="secondaryDisassemblyIPIndication"
verticalRulerPreferenceKey="secondaryDisassemblyIPVerticalRuler" verticalRulerPreferenceKey="secondaryDisassemblyIPVerticalRuler"
overviewRulerPreferenceKey="secondaryDisassemblyIPOverviewRuler"> overviewRulerPreferenceKey="secondaryDisassemblyIPOverviewRuler">
@ -1273,6 +1273,16 @@
type="org.eclipse.debug.ui.actions.IRunToLineTarget"> type="org.eclipse.debug.ui.actions.IRunToLineTarget">
</adapter> </adapter>
</factory> </factory>
<factory
adaptableType="org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView"
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory">
<adapter
type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
</adapter>
<adapter
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
</adapter>
</factory>
</extension> </extension>
</plugin> </plugin>

View file

@ -22,3 +22,4 @@ ToggleBreakpointAdapter.Empty_editor_2=Empty editor
ToggleBreakpointAdapter.Missing_document_2=Missing document ToggleBreakpointAdapter.Missing_document_2=Missing document
ToggleBreakpointAdapter.Missing_resource_2=Missing resource ToggleBreakpointAdapter.Missing_resource_2=Missing resource
ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression: ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression:
RunToLineAdapter.Operation_is_not_supported_1=Operation is not supported.

View file

@ -29,6 +29,6 @@ public class BreakpointLocationVerifier
public int getValidAddressBreakpointLocation( IDocument doc, int lineNumber ) public int getValidAddressBreakpointLocation( IDocument doc, int lineNumber )
{ {
// for now // for now
return lineNumber; return lineNumber + 1;
} }
} }

View file

@ -11,7 +11,10 @@
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants; import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -43,30 +46,52 @@ public class RunToLineAdapter implements IRunToLineTarget {
* org.eclipse.debug.core.model.ISuspendResume) * org.eclipse.debug.core.model.ISuspendResume)
*/ */
public void runToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) throws CoreException { public void runToLine( IWorkbenchPart part, ISelection selection, ISuspendResume target ) throws CoreException {
IEditorPart editorPart = (IEditorPart)part;
IEditorInput input = editorPart.getEditorInput();
String errorMessage = null; String errorMessage = null;
if ( input == null ) { if ( part instanceof IEditorPart ) {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Empty_editor_1" ); //$NON-NLS-1$ IEditorPart editorPart = (IEditorPart)part;
} IEditorInput input = editorPart.getEditorInput();
else { if ( input == null ) {
final ITextEditor textEditor = (ITextEditor)editorPart; errorMessage = ActionMessages.getString( "RunToLineAdapter.Empty_editor_1" ); //$NON-NLS-1$
final IDocument document = textEditor.getDocumentProvider().getDocument( input ); }
if ( document == null ) { else {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Missing_document_1" ); //$NON-NLS-1$ ITextEditor textEditor = (ITextEditor)editorPart;
IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Missing_document_1" ); //$NON-NLS-1$
}
else {
String fileName = getFileName( input );
ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) {
IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class );
if ( runToLine != null && runToLine.canRunToLine( fileName, lineNumber ) )
runToLine.runToLine( fileName, lineNumber );
}
return;
}
}
}
else if ( part instanceof DisassemblyView ) {
IEditorInput input = ((DisassemblyView)part).getInput();
if ( !(input instanceof DisassemblyEditorInput) ) {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Empty_editor_1" ); //$NON-NLS-1$
} }
else { else {
String fileName = getFileName( input );
ITextSelection textSelection = (ITextSelection)selection; ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1; int lineNumber = textSelection.getStartLine() + 1;
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
if ( target instanceof IAdaptable ) { if ( target instanceof IAdaptable ) {
IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class ); IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class );
if ( runToLine != null && runToLine.canRunToLine( fileName, lineNumber ) ) if ( runToAddress != null && runToAddress.canRunToAddress( address ) )
runToLine.runToLine( fileName, lineNumber ); runToAddress.runToAddress( address );
} }
return; return;
} }
} }
else {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
}
throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) ); throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
} }

View file

@ -11,8 +11,11 @@
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants; import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -36,7 +39,6 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.IEditorStatusLine; import org.eclipse.ui.texteditor.IEditorStatusLine;
import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditor;
/** /**
* Toggles a line breakpoint in a C/C++ editor. * Toggles a line breakpoint in a C/C++ editor.
*/ */
@ -46,49 +48,86 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/ */
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException { public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
IEditorPart editorPart = (IEditorPart)part;
IEditorInput input = editorPart.getEditorInput();
String errorMessage = null; String errorMessage = null;
if ( input == null ) { if ( part instanceof IEditorPart ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$ IEditorPart editorPart = (IEditorPart)part;
} IEditorInput input = editorPart.getEditorInput();
else { if ( input == null ) {
ITextEditor textEditor = (ITextEditor)editorPart; errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
} }
else { else {
IResource resource = getResource( textEditor ); ITextEditor textEditor = (ITextEditor)editorPart;
if ( resource == null ) { IDocument document = textEditor.getDocumentProvider().getDocument( input );
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$ if ( document == null ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
} }
else { else {
BreakpointLocationVerifier bv = new BreakpointLocationVerifier(); IResource resource = getResource( textEditor );
int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() ); if ( resource == null ) {
if ( lineNumber == -1 ) { errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
} }
else { else {
String sourceHandle = getSourceHandle( input ); BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
ICLineBreakpoint breakpoint = CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber ); int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() );
if ( breakpoint != null ) { if ( lineNumber == -1 ) {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
} }
else { else {
CDIDebugModel.createLineBreakpoint( sourceHandle, String sourceHandle = getSourceHandle( input );
resource, ICLineBreakpoint breakpoint = CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
lineNumber, if ( breakpoint != null ) {
true, DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
0, }
"", //$NON-NLS-1$ else {
true ); CDIDebugModel.createLineBreakpoint( sourceHandle,
resource,
lineNumber,
true,
0,
"", //$NON-NLS-1$
true );
}
return;
} }
return;
} }
} }
} }
} }
else if ( part instanceof DisassemblyView ) {
IEditorInput input = ((DisassemblyView)part).getInput();
if ( !(input instanceof DisassemblyEditorInput) ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
}
else {
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
int lineNumber = bv.getValidAddressBreakpointLocation( null, ((ITextSelection)selection).getStartLine() );
if ( lineNumber == -1 ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
}
else {
IResource resource = ResourcesPlugin.getWorkspace().getRoot();
String sourceHandle = getSourceHandle( input );
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
ICAddressBreakpoint breakpoint = CDIDebugModel.addressBreakpointExists( sourceHandle, resource, address );
if ( breakpoint != null ) {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
}
else {
CDIDebugModel.createAddressBreakpoint( sourceHandle,
resource,
address,
true,
0,
"", //$NON-NLS-1$
true );
}
return;
}
}
}
else {
errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
}
throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) ); throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
} }

View file

@ -129,6 +129,12 @@ public class DisassemblyEditorInput implements IEditorInput {
} }
return 0; return 0;
} }
public long getAddress( int lineNumber ) throws IllegalArgumentException {
if ( lineNumber > 0 && lineNumber <= fInstructions.length )
return fInstructions[--lineNumber].getAdress();
throw new IllegalArgumentException();
}
} }
public static final IEditorInput EMPTY_EDITOR_INPUT = new DisassemblyEditorInput(); public static final IEditorInput EMPTY_EDITOR_INPUT = new DisassemblyEditorInput();
@ -217,4 +223,8 @@ public class DisassemblyEditorInput implements IEditorInput {
public int getLineNumber( long address ) { public int getLineNumber( long address ) {
return ( fStorage != null ) ? fStorage.getLineNumber( address ) : 0; return ( fStorage != null ) ? fStorage.getLineNumber( address ) : 0;
} }
public long getAddress( int lineNumber ) throws IllegalArgumentException {
return ( fStorage != null ) ? fStorage.getAddress( lineNumber ) : 0;
}
} }

View file

@ -146,6 +146,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this ); CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
getSite().setSelectionProvider( viewer.getSelectionProvider() );
setEventHandler( createEventHandler() ); setEventHandler( createEventHandler() );
viewer.setDocument( getDocumentProvider().getDocument( DisassemblyEditorInput.EMPTY_EDITOR_INPUT ), getDocumentProvider().getAnnotationModel( null ) ); viewer.setDocument( getDocumentProvider().getDocument( DisassemblyEditorInput.EMPTY_EDITOR_INPUT ), getDocumentProvider().getAnnotationModel( null ) );
@ -415,7 +416,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
return null; return null;
} }
protected IEditorInput getInput() { public IEditorInput getInput() {
if ( getSourceViewer() != null ) { if ( getSourceViewer() != null ) {
Object input = getSourceViewer().getInput(); Object input = getSourceViewer().getInput();
if ( input instanceof IEditorInput ) if ( input instanceof IEditorInput )
@ -568,6 +569,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
selectionChanged( null, new StructuredSelection() ); selectionChanged( null, new StructuredSelection() );
super.becomesHidden(); super.becomesHidden();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible() * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
*/ */