mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Implementing the 'Switch to disassembly mode' action.
This commit is contained in:
parent
92c7884bc3
commit
13fd0e42e8
7 changed files with 169 additions and 7 deletions
7
debug/org.eclipse.cdt.debug.ui/ChangeLog
Normal file
7
debug/org.eclipse.cdt.debug.ui/ChangeLog
Normal file
|
@ -0,0 +1,7 @@
|
|||
2002-10-11 Mikhail Khodjaiants
|
||||
* SwitchToDisassemblyActionDelegate.java: Implementation of the 'Switch to disassembly mode' action.
|
||||
* plugin.properties: Action label and tooltip.
|
||||
* plugin.xml: Contribution to the 'Launch View'.
|
||||
* icons/full/clcl16/disassembly.gif: Hover icon.
|
||||
* icons/full/dlcl16/disassembly.gif: Disabled icon.
|
||||
* icons/full/elcl16/disassembly.gif: Enabled icon.
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/disassembly.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/disassembly.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 161 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/disassembly.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/disassembly.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 158 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/disassembly.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/disassembly.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 161 B |
|
@ -20,6 +20,9 @@ DebugActionSet.label=C/C++ Debug
|
|||
RestartAction.label=Restart
|
||||
RestartAction.tooltip=Restart
|
||||
|
||||
SwitchToDisassemblyAction.label=Disassembly Mode
|
||||
SwitchToDisassemblyAction.tooltip=Disassembly Mode On/Off
|
||||
|
||||
AddBreakpoint.label=Add/Remove &Breakpoint
|
||||
EnableBreakpoint.label=T&oggle Breakpoint
|
||||
BreakpointProperties.label=Breakpoint P&roperties...
|
||||
|
|
|
@ -222,6 +222,21 @@
|
|||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
label="%SwitchToDisassemblyAction.label"
|
||||
icon="icons/full/clcl16/disassembly.gif"
|
||||
helpContextId="switch_to_disassembly_action_context"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
|
||||
menubarPath="renderGroup"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui">
|
||||
</pluginState>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewerContribution>
|
||||
<viewerContribution
|
||||
targetID="#CEditorRulerContext"
|
||||
|
@ -339,21 +354,29 @@
|
|||
label="%RestartAction.label"
|
||||
tooltip="%RestartAction.tooltip">
|
||||
</action>
|
||||
</viewContribution>
|
||||
<viewContribution
|
||||
targetID="org.eclipse.debug.ui.DebugView"
|
||||
id="org.eclipse.cdt.debug.ui.debugview.toolbar">
|
||||
<action
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
label="%ShowFullPathsAction.label"
|
||||
toolbarPath="renderGroup"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
disabledIcon="icons/full/dlcl16/show_paths.gif"
|
||||
hoverIcon="icons/full/clcl16/show_paths.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
|
||||
disabledIcon="icons/full/dlcl16/show_paths.gif"
|
||||
icon="icons/full/elcl16/show_parents.gif"
|
||||
helpContextId="show_full_paths_action_context"
|
||||
label="%ShowFullPathsAction.label"
|
||||
tooltip="%ShowFullPathsAction.tooltip">
|
||||
</action>
|
||||
<action
|
||||
toolbarPath="renderGroup"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
|
||||
hoverIcon="icons/full/clcl16/disassembly.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
|
||||
disabledIcon="icons/full/dlcl16/disassembly.gif"
|
||||
enablesFor="1"
|
||||
icon="icons/full/elcl16/disassembly.gif"
|
||||
helpContextId="switch_to_disassembly_action_context"
|
||||
label="%SwitchToDisassemblyAction.label"
|
||||
tooltip="%SwitchToDisassemblyAction.tooltip">
|
||||
</action>
|
||||
</viewContribution>
|
||||
<viewContribution
|
||||
targetID="org.eclipse.debug.ui.BreakpointView"
|
||||
|
@ -434,6 +457,9 @@
|
|||
<action
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
|
||||
</action>
|
||||
<action
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate">
|
||||
</action>
|
||||
</debugActionGroup>
|
||||
</extension>
|
||||
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Oct 11, 2002
|
||||
*/
|
||||
public class SwitchToDisassemblyActionDelegate extends AbstractListenerActionDelegate
|
||||
{
|
||||
private IViewPart fViewPart = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
|
||||
*/
|
||||
protected void doAction( Object element ) throws DebugException
|
||||
{
|
||||
if ( element != null && element instanceof CDebugElement )
|
||||
{
|
||||
ISourceMode sourceMode = (ISourceMode)((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class );
|
||||
if ( sourceMode != null )
|
||||
{
|
||||
sourceMode.setMode( ( sourceMode.getMode() == ISourceMode.MODE_SOURCE ) ? ISourceMode.MODE_DISASSEMBLY : ISourceMode.MODE_SOURCE );
|
||||
((CDebugElement)element).fireChangeEvent( DebugEvent.CLIENT_REQUEST );
|
||||
if ( fViewPart != null && fViewPart instanceof ISelectionChangedListener )
|
||||
{
|
||||
final ISelectionChangedListener view = (ISelectionChangedListener)fViewPart;
|
||||
fViewPart.getViewSite().getShell().getDisplay().asyncExec(
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
view.selectionChanged( null );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
|
||||
*/
|
||||
protected boolean isEnabledFor( Object element )
|
||||
{
|
||||
if ( element != null && element instanceof CDebugElement )
|
||||
{
|
||||
return ( ((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class ) != null );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractDebugActionDelegate#enableForMultiSelection()
|
||||
*/
|
||||
protected boolean enableForMultiSelection()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractDebugActionDelegate#getStatusMessage()
|
||||
*/
|
||||
protected String getStatusMessage()
|
||||
{
|
||||
return "Exceptions occurred attempting to switch to disassembly/source mode.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
|
||||
*/
|
||||
protected String getErrorDialogMessage()
|
||||
{
|
||||
return "Switch to disassembly/source mode failed.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
|
||||
*/
|
||||
protected String getErrorDialogTitle()
|
||||
{
|
||||
return "Switch to disassembly/source mode";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
|
||||
*/
|
||||
public void selectionChanged( IAction action, ISelection selection )
|
||||
{
|
||||
super.selectionChanged( action, selection );
|
||||
boolean checked = false;
|
||||
if ( selection != null && selection instanceof IStructuredSelection )
|
||||
{
|
||||
Object element = ((IStructuredSelection)selection).getFirstElement();
|
||||
if ( element != null && element instanceof CDebugElement )
|
||||
{
|
||||
ISourceMode sourceMode = (ISourceMode)((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class );
|
||||
checked = ( sourceMode != null && sourceMode.getMode() == ISourceMode.MODE_DISASSEMBLY );
|
||||
}
|
||||
}
|
||||
action.setChecked( checked );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
|
||||
*/
|
||||
public void init( IViewPart view )
|
||||
{
|
||||
super.init( view );
|
||||
fViewPart = view;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue