From 80ad51d3a920fd8719a1202ed55e6d0dc5e1086f Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 18 Sep 2002 20:58:54 +0000 Subject: [PATCH] Added 'Add expresion' action to the C editor context menu. --- .../actions/AddExpressionActionDelegate.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionActionDelegate.java index e08fe9a063e..6b990c46194 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionActionDelegate.java @@ -87,16 +87,7 @@ public class AddExpressionActionDelegate implements IWorkbenchWindowActionDelega } window.getPartService().addPartListener( this ); window.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - IAdaptable context = DebugUITools.getDebugContext(); - if ( context != null && context instanceof IDebugElement ) - { - IDebugTarget target = ((IDebugElement)context).getDebugTarget(); - if ( target != null && target instanceof ICExpressionEvaluator ) - { - setDebugTarget( target ); - } - - } + initializeDebugTarget(); update(); } @@ -215,6 +206,7 @@ public class AddExpressionActionDelegate implements IWorkbenchWindowActionDelega { setAction( action ); setTargetPart( targetEditor ); + initializeDebugTarget(); update(); } @@ -311,4 +303,18 @@ public class AddExpressionActionDelegate implements IWorkbenchWindowActionDelega { 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 ); + } + } + } }