mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-14 11:45:38 +02:00
Follow up fix for 228063
This commit is contained in:
parent
35e40a0f8e
commit
4bf9d0cd24
1 changed files with 24 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 QNX Software Systems and others.
|
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
|
||||||
import org.eclipse.cdt.debug.core.model.ITargetProperties;
|
import org.eclipse.cdt.debug.core.model.ITargetProperties;
|
||||||
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.IAdaptable;
|
||||||
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
|
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
|
||||||
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
|
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
|
@ -66,6 +67,7 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IActionDelegate2#dispose()
|
* @see org.eclipse.ui.IActionDelegate2#dispose()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
ISteppingModeTarget target = getTarget();
|
ISteppingModeTarget target = getTarget();
|
||||||
if ( target != null && target instanceof ITargetProperties ) {
|
if ( target != null && target instanceof ITargetProperties ) {
|
||||||
|
@ -78,6 +80,7 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
|
* @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init( IAction action ) {
|
public void init( IAction action ) {
|
||||||
setAction( action );
|
setAction( action );
|
||||||
action.setChecked( false );
|
action.setChecked( false );
|
||||||
|
@ -87,12 +90,13 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void run( IAction action ) {
|
public void run( IAction action ) {
|
||||||
boolean enabled = getAction().isChecked();
|
boolean enabled = getAction().isChecked();
|
||||||
ISteppingModeTarget target = getTarget();
|
ISteppingModeTarget target = getTarget();
|
||||||
if ( target != null ) {
|
if ( target != null ) {
|
||||||
target.enableInstructionStepping( enabled );
|
target.enableInstructionStepping( enabled );
|
||||||
if ( enabled ) {
|
if ( enabled && target instanceof ICDebugTarget ) {
|
||||||
try {
|
try {
|
||||||
getView().getSite().getPage().showView( ICDebugUIConstants.ID_DISASSEMBLY_VIEW );
|
getView().getSite().getPage().showView( ICDebugUIConstants.ID_DISASSEMBLY_VIEW );
|
||||||
}
|
}
|
||||||
|
@ -106,6 +110,7 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
|
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void runWithEvent( IAction action, Event event ) {
|
public void runWithEvent( IAction action, Event event ) {
|
||||||
run( action );
|
run( action );
|
||||||
}
|
}
|
||||||
|
@ -113,6 +118,7 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void selectionChanged( IAction action, ISelection selection ) {
|
public void selectionChanged( IAction action, ISelection selection ) {
|
||||||
ISteppingModeTarget newTarget = null;
|
ISteppingModeTarget newTarget = null;
|
||||||
if ( selection instanceof IStructuredSelection ) {
|
if ( selection instanceof IStructuredSelection ) {
|
||||||
|
@ -160,12 +166,20 @@ public class ToggleInstructionStepModeActionDelegate extends ActionDelegate impl
|
||||||
this.fAction = action;
|
this.fAction = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICDebugTarget getTargetFromSelection( Object element ) {
|
private ISteppingModeTarget getTargetFromSelection( Object element ) {
|
||||||
|
ISteppingModeTarget target= null;
|
||||||
if ( element instanceof IDebugElement ) {
|
if ( element instanceof IDebugElement ) {
|
||||||
IDebugTarget target = ((IDebugElement)element).getDebugTarget();
|
IDebugTarget debugTarget = ((IDebugElement)element).getDebugTarget();
|
||||||
return ( target instanceof ICDebugTarget ) ? (ICDebugTarget)target : null;
|
if (debugTarget instanceof ISteppingModeTarget) {
|
||||||
|
target= (ISteppingModeTarget) debugTarget;
|
||||||
}
|
}
|
||||||
return null;
|
}
|
||||||
|
if (target == null) {
|
||||||
|
if (element instanceof IAdaptable) {
|
||||||
|
target= (ISteppingModeTarget) ((IAdaptable)element).getAdapter(ISteppingModeTarget.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IViewPart getView() {
|
private IViewPart getView() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue