1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-15 04:05:38 +02:00

Added 'Add expresion' action to the C editor context menu.

This commit is contained in:
Mikhail Khodjaiants 2002-09-18 20:58:54 +00:00
parent b47529d93e
commit 80ad51d3a9

View file

@ -87,16 +87,7 @@ public class AddExpressionActionDelegate implements IWorkbenchWindowActionDelega
} }
window.getPartService().addPartListener( this ); window.getPartService().addPartListener( this );
window.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); window.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
IAdaptable context = DebugUITools.getDebugContext(); initializeDebugTarget();
if ( context != null && context instanceof IDebugElement )
{
IDebugTarget target = ((IDebugElement)context).getDebugTarget();
if ( target != null && target instanceof ICExpressionEvaluator )
{
setDebugTarget( target );
}
}
update(); update();
} }
@ -215,6 +206,7 @@ public class AddExpressionActionDelegate implements IWorkbenchWindowActionDelega
{ {
setAction( action ); setAction( action );
setTargetPart( targetEditor ); setTargetPart( targetEditor );
initializeDebugTarget();
update(); update();
} }
@ -311,4 +303,18 @@ public class AddExpressionActionDelegate implements IWorkbenchWindowActionDelega
{ {
return fDebugTarget; return fDebugTarget;
} }
protected void initializeDebugTarget()
{
setDebugTarget( null );
IAdaptable context = DebugUITools.getDebugContext();
if ( context != null && context instanceof IDebugElement )
{
IDebugTarget target = ((IDebugElement)context).getDebugTarget();
if ( target != null && target instanceof ICExpressionEvaluator )
{
setDebugTarget( target );
}
}
}
} }