1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added the 'Add Address Breakpoint' action to the workbench 'Run' menu.

This commit is contained in:
Mikhail Khodjaiants 2003-01-14 20:26:28 +00:00
parent 40300813c0
commit a9eae1b09a
5 changed files with 151 additions and 7 deletions

View file

@ -1,4 +1,11 @@
2003-01-10 Mikhail Khodjaiants
2003-01-14 Mikhail Khodjaiants
Added the 'Add Address Breakpoint' action to the workbench 'Run' menu.
* AddAddressBreakpointActionDelegate.java
* plugin.properties
* plugin.xml
* icons/full/obj16/brkp_obj.gif
2003-01-13 Mikhail Khodjaiants
Implementation of the 'Run To Line' action for disassembly.
* RunToLineActionDelegate.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

View file

@ -33,6 +33,7 @@ ManageBreakpointAction.label=Add/Remove C/C++ Brea&kpoint
BreakpointPropertiesAction.label=P&roperties...
ManageWatchpointAction.label=Add C/C++ &Watchpoint...
AddExpressionAction.label=Add C/C++ &Expression...
AddAddressBreakpointAction.label=Add &Address Breakpoint...
RunToLineAction.label=Run To C/C++ &Line
ShowFullPathsAction.label=Show Full Paths
ShowFullPathsAction.tooltip=Show Full Paths

View file

@ -146,7 +146,7 @@
</action>
<action
label="%ManageBreakpointAction.label"
icon="icons/full/obj16/brkpi_obj.gif"
icon="icons/full/obj16/brkp_obj.gif"
helpContextId="manage_breakpoint_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointActionDelegate"
menubarPath="org.eclipse.ui.run/cBreakpointGroup"
@ -158,6 +158,21 @@
</pluginState>
</enablement>
</action>
<action
label="%AddAddressBreakpointAction.label"
icon="icons/full/obj16/addrbrkp_obj.gif"
helpContextId="add_address_breakpoint_action_context"
class="org.eclipse.cdt.debug.internal.ui.AddAddressBreakpointActionDelegate"
menubarPath="org.eclipse.ui.run/cBreakpointGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.AddAddressBreakpointActionDelegate">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
<action
label="%ManageWatchpointAction.label"
icon="icons/full/obj16/readwrite_obj.gif"
@ -747,9 +762,9 @@
targetID="org.eclipse.cdt.ui.editor.asm.AsmEditor"
id="org.eclipse.cdt.ui.editor.asm.AsmEditor.BreakpointRulerActions">
<action
label="%Dummy.label"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
actionID="RulerDoubleClick"
label="%Dummy.label"
id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction">
<enablement>
<pluginState
@ -763,14 +778,14 @@
targetID="org.eclipse.cdt.debug.ui.DisassemblyEditor"
id="org.eclipse.cdt.debug.ui.DisassemblyEditor.BreakpointRulerActions">
<action
actionID="RulerDoubleClick"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
label="%Dummy.label"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
actionID="RulerDoubleClick"
id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction">
<enablement>
<pluginState
id="org.eclipse.cdt.debug.ui"
value="activated">
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
@ -827,6 +842,9 @@
<action
id="org.eclipse.cdt.debug.internal.ui.actions.AddGlobalsActionDelegate">
</action>
<action
id="org.eclipse.cdt.debug.internal.ui.AddAddressBreakpointActionDelegate">
</action>
</debugActionGroup>
</extension>
<extension

View file

@ -0,0 +1,118 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.model.IExecFileInfo;
import org.eclipse.cdt.debug.internal.ui.actions.AbstractListenerActionDelegate;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
/**
*
* Enter type comment.
*
* @since Jan 13, 2003
*/
public class AddAddressBreakpointActionDelegate extends AbstractListenerActionDelegate
{
/**
*
* Enter type comment.
*
* @since Jan 13, 2003
*/
public class AddressValidator implements IInputValidator
{
/**
* Constructor for AddressValidator.
*/
public AddressValidator()
{
super();
}
/**
* @see org.eclipse.jface.dialogs.IInputValidator#isValid(String)
*/
public String isValid( String newText )
{
if ( newText.trim().length() == 0 )
return "";
long value = 0;
try
{
value = parseValue( newText.trim() );
}
catch( NumberFormatException e )
{
return "Invalid address.";
}
return ( value > 0 ) ? null : "Address can not be 0.";
}
}
/**
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
*/
protected void doAction( Object element ) throws DebugException
{
InputDialog dialog = new InputDialog( getPage().getWorkbenchWindow().getShell(),
"Add Address Breakpoint",
"Enter address:",
null,
new AddressValidator() );
if ( dialog.open() == dialog.OK )
{
CDebugModel.createAddressBreakpoint( ((IExecFileInfo)getDebugTarget( element ).getAdapter( IExecFileInfo.class )).getExecFile(),
-1,
parseValue( dialog.getValue().trim() ),
true,
0,
"",
true );
}
}
/**
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
*/
protected boolean isEnabledFor( Object element )
{
if ( element != null && element instanceof IDebugElement )
{
IDebugTarget target = getDebugTarget( element );
return ( target != null && !target.isTerminated() && target.getAdapter( IExecFileInfo.class ) != null );
}
return false;
}
protected long parseValue( String text ) throws NumberFormatException
{
long value = 0;
if ( text.trim().startsWith( "0x" ) )
{
value = Integer.parseInt( text.substring( 2 ), 16 );
}
else
{
value = Integer.parseInt( text );
}
return value;
}
private IDebugTarget getDebugTarget( Object element )
{
if ( element != null && element instanceof IDebugElement )
{
return ((IDebugElement)element).getDebugTarget();
}
return null;
}
}