1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Partial fix for bug 83465: Add "Run to line" and "Resume at line" actions to the context menu of Disassembly view.

This commit is contained in:
Mikhail Khodjaiants 2005-01-21 23:03:46 +00:00
parent e22c304553
commit e5798cdbb5
4 changed files with 55 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-01-21 Mikhail Khodjaiants
Partial fix for bug 83465: Add "Run to line" and "Resume at line" actions to the context menu of Disassembly view.
* ResumeAtLineActionDelegate.java
* DisassemblyView.java
* plugin.xml
2005-01-21 Mikhail Khodjaiants 2005-01-21 Mikhail Khodjaiants
Fix for bug 83437: Loading symbols should be run in the background. Fix for bug 83437: Loading symbols should be run in the background.
* ActionMessages.properties * ActionMessages.properties

View file

@ -694,6 +694,26 @@
</selection> </selection>
</action> </action>
</viewerContribution> </viewerContribution>
<viewerContribution
targetID="#DisassemblyViewContext"
id="org.eclipse.cdt.debug.ui.disassemblyView.popupMenu">
<visibility>
<and>
<systemProperty
value="true"
name="org.eclipse.cdt.debug.ui.debuggerActive"/>
<objectClass name="org.eclipse.jface.text.ITextSelection"/>
</and>
</visibility>
<action
helpContextId="jump_to_line_action_context"
enablesFor="1"
label="%JumpToLineAction.label"
icon="icons/full/clcl16/jump_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.ResumeAtLineActionDelegate"
menubarPath="additions"
id="org.eclipse.cdt.debug.internal.ui.actions.JumpToLineActionDelegate"/>
</viewerContribution>
</extension> </extension>
<extension <extension
point="org.eclipse.ui.viewActions"> point="org.eclipse.ui.viewActions">

View file

@ -17,7 +17,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IRunToLineTarget;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.ISelectionProvider;
@ -27,6 +26,8 @@ import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IEditorActionDelegate; import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.IWorkbenchPartSite;
@ -35,9 +36,9 @@ import org.eclipse.ui.IWorkbenchPartSite;
* will perform the "resume at line" operation for editors that provide * will perform the "resume at line" operation for editors that provide
* an appropriate <code>IResumeAtLineTarget</code> adapter. * an appropriate <code>IResumeAtLineTarget</code> adapter.
*/ */
public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IActionDelegate2 { public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IViewActionDelegate, IActionDelegate2 {
private IEditorPart fActivePart = null; private IWorkbenchPart fActivePart = null;
private IResumeAtLineTarget fPartTarget = null; private IResumeAtLineTarget fPartTarget = null;
@ -83,7 +84,7 @@ public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IActio
if ( fPartTarget == null ) { if ( fPartTarget == null ) {
IAdapterManager adapterManager = Platform.getAdapterManager(); IAdapterManager adapterManager = Platform.getAdapterManager();
// TODO: we could restrict loading to cases when the debugging context is on // TODO: we could restrict loading to cases when the debugging context is on
if ( adapterManager.hasAdapter( targetEditor, IRunToLineTarget.class.getName() ) ) { if ( adapterManager.hasAdapter( targetEditor, IResumeAtLineTarget.class.getName() ) ) {
fPartTarget = (IResumeAtLineTarget)adapterManager.loadAdapter( targetEditor, IResumeAtLineTarget.class.getName() ); fPartTarget = (IResumeAtLineTarget)adapterManager.loadAdapter( targetEditor, IResumeAtLineTarget.class.getName() );
} }
} }
@ -158,4 +159,23 @@ public class ResumeAtLineActionDelegate implements IEditorActionDelegate, IActio
} }
fAction.setEnabled( enabled ); fAction.setEnabled( enabled );
} }
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
public void init( IViewPart view ) {
fActivePart = view;
if ( view != null ) {
view.getSite().getWorkbenchWindow().getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, fSelectionListener );
fPartTarget = (IResumeAtLineTarget)view.getAdapter( IResumeAtLineTarget.class );
if ( fPartTarget == null ) {
IAdapterManager adapterManager = Platform.getAdapterManager();
// TODO: we could restrict loading to cases when the debugging context is on
if ( adapterManager.hasAdapter( view, IResumeAtLineTarget.class.getName() ) ) {
fPartTarget = (IResumeAtLineTarget)adapterManager.loadAdapter( view, IResumeAtLineTarget.class.getName() );
}
}
}
update();
}
} }

View file

@ -860,6 +860,11 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
StyledText styledText = getSourceViewer().getTextWidget(); StyledText styledText = getSourceViewer().getTextWidget();
setTextContextMenu( manager.createContextMenu( styledText ) ); setTextContextMenu( manager.createContextMenu( styledText ) );
styledText.setMenu( getTextContextMenu() ); styledText.setMenu( getTextContextMenu() );
// register the context menu such that other plugins may contribute to it
if ( getSite() != null ) {
getSite().registerContextMenu( getViewContextMenuId(), manager, getSourceViewer() );
}
} }
private void createRulerContextMenu() { private void createRulerContextMenu() {