diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index a31f243c0ad..63d10b0b6ae 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,12 @@
+2004-05-19 Mikhail Khodjaiants
+ Added the support of watch expressions.
+ * CDIDebugModel.java
+ * ICStackFrame.java
+ * CExpressionTarget.java: new
+ * CDebugTarget.java
+ * CExpression.java
+ * CStackFrame.java
+
2004-05-14 Mikhail Khodjaiants
Update disassembly when source locator is changed.
* Disassembly.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
index ee94ae8d3ea..93a2945d8bd 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
@@ -12,6 +12,10 @@ package org.eclipse.cdt.debug.core;
import java.util.HashMap;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
@@ -21,12 +25,20 @@ import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
+import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
+import org.eclipse.cdt.debug.internal.core.model.CExpression;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IExpression;
/**
* Provides utility methods for creating debug sessions, targets and
@@ -349,4 +361,32 @@ public class CDIDebugModel {
}
return null;
}
+
+ public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException {
+ if ( target != null && target instanceof CDebugTarget ) {
+ try {
+ ICDIExpression cdiExpression = ((CDebugTarget)target).getCDISession().getExpressionManager().createExpression( text );
+ return new CExpression( (CDebugTarget)target, cdiExpression );
+ }
+ catch( CDIException e ) {
+ throw new DebugException( new Status( IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null ) );
+ }
+ }
+ return null;
+ }
+
+ public static IExpression createExpressionForGlobalVariable( IDebugTarget target, IPath fileName, String name ) throws DebugException {
+ if ( target != null && target instanceof CDebugTarget ) {
+ ICDIVariableObject vo = null;
+ try {
+ vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject( fileName.lastSegment(), null, name );
+ ICDIVariable cdiVariable = ((CDebugTarget)target).getCDISession().getVariableManager().createVariable( vo );
+ return new CExpression( (CDebugTarget)target, cdiVariable );
+ }
+ catch( CDIException e ) {
+ throw new DebugException( new Status( IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICStackFrame.java
index f2a36260b7a..eb5fc4c94bd 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICStackFrame.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICStackFrame.java
@@ -10,7 +10,9 @@
***********************************************************************/
package org.eclipse.cdt.debug.core.model;
+import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IValue;
/**
* C/C++ extension of IStackFrame
.
@@ -54,4 +56,13 @@ public interface ICStackFrame extends IStackFrame, ICDebugElement {
* @return the level of this stack frame
*/
public int getLevel();
+
+ /**
+ * Evaluates the given expression in the context of this stack frame.
+ *
+ * @param expression expression to evaluate
+ * @return the evaluation result
+ * @throws DebugException if this method fails.
+ */
+ public IValue evaluateExpression( String expression ) throws DebugException;
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CExpressionTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CExpressionTarget.java
new file mode 100644
index 00000000000..795c20d5e9e
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CExpressionTarget.java
@@ -0,0 +1,56 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.cdt.debug.internal.core;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
+import org.eclipse.cdt.debug.internal.core.model.CExpression;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+
+/**
+ * Implements the expression evaluation target.
+ */
+public class CExpressionTarget {
+
+ private CDebugTarget fDebugTarget;
+ private Map fExpressions = null;
+
+ public CExpressionTarget( CDebugTarget target ) {
+ fDebugTarget = target;
+ fExpressions = new HashMap( 10 );
+ }
+
+ public CDebugTarget getDebugTarget() {
+ return fDebugTarget;
+ }
+
+ public IValue evaluateExpression( String expressionText ) throws DebugException {
+ CExpression expression = (CExpression)fExpressions.remove( expressionText );
+ if ( expression != null ) {
+ expression.dispose();
+ }
+ expression = (CExpression)CDIDebugModel.createExpression( getDebugTarget(), expressionText );
+ fExpressions.put( expressionText, expression );
+ return expression.getValue();
+ }
+
+ public void dispose() {
+ Iterator it = fExpressions.values().iterator();
+ while( it.hasNext() ) {
+ ((CExpression)it.next()).dispose();
+ }
+ fExpressions.clear();
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
index 8d87b0e99e8..00163f7a6ce 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
@@ -74,6 +74,7 @@ import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
+import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
import org.eclipse.cdt.debug.internal.core.CRegisterManager;
import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager;
@@ -162,11 +163,6 @@ public class CDebugTarget extends CDebugElement
*/
private IProcess fDebuggeeProcess = null;
- /**
- * Associated debugger process, or null
if not available.
- */
-// private IProcess fDebuggerProcess = null;
-
/**
* The underlying CDI target.
*/
@@ -252,10 +248,7 @@ public class CDebugTarget extends CDebugElement
*/
private CBreakpointManager fBreakpointManager;
- /**
- * Whether the debugger process is default.
- */
-// private boolean fIsDebuggerProcessDefault = false;
+ private CExpressionTarget fExpressionTarget;
/**
* The suspension thread.
@@ -1002,6 +995,8 @@ public class CDebugTarget extends CDebugElement
return getSignalManager();
if ( adapter.equals( ICRegisterManager.class ) )
return getRegisterManager();
+ if ( adapter.equals( CExpressionTarget.class ) )
+ return getExpressionTarget();
if ( adapter.equals( ICDISession.class ) )
return getCDISession();
return super.getAdapter( adapter );
@@ -1238,6 +1233,7 @@ public class CDebugTarget extends CDebugElement
disposeDisassembly();
disposeSourceManager();
disposeBreakpointManager();
+ disposeExpresionTarget();
removeAllExpressions();
disposePreferences();
}
@@ -2238,6 +2234,12 @@ public class CDebugTarget extends CDebugElement
}
}
+ private void disposeExpresionTarget() {
+ if ( fExpressionTarget != null ) {
+ fExpressionTarget.dispose();
+ fExpressionTarget = null;
+ }
+ }
protected RunningInfo getRunningInfo()
{
return fRunningInfo;
@@ -2479,4 +2481,11 @@ public class CDebugTarget extends CDebugElement
if ( fPreferences!= null )
fPreferences.removePropertyChangeListener( listener );
}
+
+ protected CExpressionTarget getExpressionTarget() {
+ if ( fExpressionTarget == null ) {
+ fExpressionTarget = new CExpressionTarget( this );
+ }
+ return fExpressionTarget;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java
index 529d3254190..c9449fd691a 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java
@@ -12,8 +12,10 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IValue;
@@ -81,11 +83,21 @@ public class CExpression extends CModificationVariable
public void dispose()
{
super.dispose();
+ try {
+ ICDIExpression cdiExpression = getCDIExpression();
+ if ( cdiExpression != null ) {
+ getCDISession().getExpressionManager().destroyExpression( cdiExpression );
+ }
+ }
+ catch( CDIException e ) {
+ DebugPlugin.log( e );
+ }
}
protected ICDIExpression getCDIExpression() throws CDIException
{
- return (ICDIExpression)getCDIVariable();
+ ICDIVariable var = getCDIVariable();
+ return ( var instanceof ICDIExpression ) ? (ICDIExpression)var : null;
}
/**
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java
index ee23038a324..7a38a3f8f65 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java
@@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
-
+import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@@ -26,12 +26,15 @@ import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
+import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IRegisterGroup;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
/**
@@ -796,4 +799,12 @@ public class CStackFrame extends CDebugElement
((IResumeWithoutSignal)getDebugTarget()).resumeWithoutSignal();
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String)
+ */
+ public IValue evaluateExpression( String expression ) throws DebugException {
+ CExpressionTarget target = (CExpressionTarget)getDebugTarget().getAdapter( CExpressionTarget.class );
+ return ( target != null ) ? target.evaluateExpression( expression ) : null;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 7de71ed8824..9b555eca152 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-19 Mikhail Khodjaiants
+ Added the support of watch expressions.
+ * CDTDebugModelPresentation.java
+ * CWatchExpressionDelegate.java: new
+ * CDebugUIPluginResources.properties
+ * plugin.xml
+
2004-05-14 Mikhail Khodjaiants
Refresh the Disassembly view on change events.
* DisassemblyEditorInput.java
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index fba4abe9311..0606e52454e 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1301,5 +1301,11 @@
+
+
+
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
index 48c86328002..2cc7e45bab4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
@@ -59,6 +59,9 @@ import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.core.model.IWatchExpression;
+import org.eclipse.debug.internal.ui.DebugUIMessages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -176,8 +179,7 @@ public class CDTDebugModelPresentation extends LabelProvider
{
if ( ((EditorInputDelegate)input).getDelegate() == null )
return CDebugEditor.EDITOR_ID;
- else
- return getEditorId( ((EditorInputDelegate)input).getDelegate(), element );
+ return getEditorId( ((EditorInputDelegate)input).getDelegate(), element );
}
String id = null;
@@ -215,6 +217,8 @@ public class CDTDebugModelPresentation extends LabelProvider
break;
}
}
+ if ( element instanceof IWatchExpression && ((IWatchExpression)element).hasErrors() )
+ overlays[OverlayImageDescriptor.BOTTOM_LEFT] = CDebugImages.DESC_OVRS_ERROR;
if ( element instanceof ICVariable && ((ICVariable)element).isArgument() )
overlays[OverlayImageDescriptor.TOP_RIGHT] = CDebugImages.DESC_OVRS_ARGUMENT;
@@ -238,10 +242,7 @@ public class CDTDebugModelPresentation extends LabelProvider
{
return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED ) );
}
- else
- {
- return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_DEBUG_TARGET ) );
- }
+ return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_DEBUG_TARGET ) );
}
if ( element instanceof IThread )
{
@@ -338,6 +339,11 @@ public class CDTDebugModelPresentation extends LabelProvider
return label.toString();
}
+ if ( element instanceof IWatchExpression )
+ {
+ return getWatchExpressionText( (IWatchExpression)element );
+ }
+
if ( element instanceof IVariable )
{
label.append( getVariableText( (IVariable)element ) );
@@ -401,7 +407,7 @@ public class CDTDebugModelPresentation extends LabelProvider
CDebugUIPlugin.log( e );
}
- return null;
+ return getDefaultText( element );
}
protected boolean isShowQualifiedNames()
@@ -554,6 +560,27 @@ public class CDTDebugModelPresentation extends LabelProvider
return DUMMY_STACKFRAME_LABEL;
}
+ protected String getWatchExpressionText( IWatchExpression expression ) {
+ StringBuffer result = new StringBuffer();
+ result.append( '"' ).append( expression.getExpressionText() ).append( '"' );
+ if ( expression.isPending() ) {
+ result.append( " = " ).append( "..." ); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ else {
+ IValue value = expression.getValue();
+ if ( value != null ) {
+ String valueString = DebugUIPlugin.getModelPresentation().getText( value );
+ if ( valueString.length() > 0 ) {
+ result.append( " = " ).append( valueString ); //$NON-NLS-1$
+ }
+ }
+ }
+ if ( !expression.isEnabled() ) {
+ result.append( CDebugUIPlugin.getResourceString( "internal.ui.CDTDebugModelPresentation.disabled" ) ); //$NON-NLS-1$
+ }
+ return result.toString();
+ }
+
protected String getVariableText( IVariable var ) throws DebugException
{
StringBuffer label = new StringBuffer();
@@ -587,8 +614,6 @@ public class CDTDebugModelPresentation extends LabelProvider
label.append( ' ' );
}
}
- if ( !((ICVariable)var).isEnabled() )
- label.append( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.disabled") ); //$NON-NLS-1$
String name = var.getName();
if ( name != null )
label.append( name.trim() );
@@ -625,10 +650,12 @@ public class CDTDebugModelPresentation extends LabelProvider
}
}
}
+ if ( !((ICVariable)var).isEnabled() )
+ label.append( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.disabled") ); //$NON-NLS-1$
return label.toString();
}
- protected String getSharedLibraryText( ICSharedLibrary library, boolean qualified ) throws DebugException
+ protected String getSharedLibraryText( ICSharedLibrary library, boolean qualified )
{
String label = new String();
IPath path = new Path( library.getFileName() );
@@ -774,7 +801,7 @@ public class CDTDebugModelPresentation extends LabelProvider
return label.toString();
}
- protected StringBuffer appendResourceName( ICBreakpoint breakpoint, StringBuffer label, boolean qualified ) throws CoreException
+ protected StringBuffer appendResourceName( ICBreakpoint breakpoint, StringBuffer label, boolean qualified )
{
IPath path = breakpoint.getMarker().getResource().getLocation();
if ( !path.isEmpty() )
@@ -897,7 +924,7 @@ public class CDTDebugModelPresentation extends LabelProvider
return overlays;
}
- protected Image getVariableImage( IVariable element ) throws DebugException
+ protected Image getVariableImage( IVariable element )
{
if ( element instanceof ICVariable )
{
@@ -923,22 +950,22 @@ public class CDTDebugModelPresentation extends LabelProvider
return null;
}
- protected Image getRegisterGroupImage( IRegisterGroup element ) throws DebugException
+ protected Image getRegisterGroupImage( IRegisterGroup element )
{
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP );
}
- protected Image getRegisterImage( IRegister element ) throws DebugException
+ protected Image getRegisterImage( IRegister element )
{
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER );
}
- protected Image getExpressionImage( IExpression element ) throws DebugException
+ protected Image getExpressionImage( IExpression element )
{
return fDebugImageRegistry.get( DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_EXPRESSION ) );
}
- protected Image getSharedLibraryImage( ICSharedLibrary element ) throws DebugException
+ protected Image getSharedLibraryImage( ICSharedLibrary element )
{
if ( element.areSymbolsLoaded() )
{
@@ -972,4 +999,18 @@ public class CDTDebugModelPresentation extends LabelProvider
{
return ( str == null || str.length() == 0 );
}
+
+ /**
+ * Returns a default text label for the debug element
+ */
+ protected String getDefaultText(Object element) {
+ return DebugUIPlugin.getDefaultLabelProvider().getText( element );
+ }
+
+ /**
+ * Returns a default image for the debug element
+ */
+ protected Image getDefaultImage(Object element) {
+ return DebugUIPlugin.getDefaultLabelProvider().getImage( element );
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CWatchExpressionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CWatchExpressionDelegate.java
new file mode 100644
index 00000000000..0f64204a015
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CWatchExpressionDelegate.java
@@ -0,0 +1,77 @@
+/**********************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ ***********************************************************************/
+package org.eclipse.cdt.debug.internal.ui;
+
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IWatchExpressionDelegate;
+import org.eclipse.debug.core.model.IWatchExpressionListener;
+import org.eclipse.debug.core.model.IWatchExpressionResult;
+
+public class CWatchExpressionDelegate implements IWatchExpressionDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IWatchExpressionDelegate#evaluateExpression(java.lang.String, org.eclipse.debug.core.model.IDebugElement, org.eclipse.debug.core.model.IWatchExpressionListener)
+ */
+ public void evaluateExpression( final String expression, IDebugElement context, final IWatchExpressionListener listener ) {
+ if ( !(context instanceof ICStackFrame) ) {
+ listener.watchEvaluationFinished( null );
+ return;
+ }
+ final ICStackFrame frame = (ICStackFrame)context;
+ Runnable runnable = new Runnable() {
+ public void run() {
+ IValue value = null;
+ DebugException de = null;
+ try {
+ value = frame.evaluateExpression( expression );
+ }
+ catch( DebugException e ) {
+ de = e;
+ }
+ IWatchExpressionResult result = evaluationComplete( expression, value, de );
+ listener.watchEvaluationFinished( result );
+ }
+ };
+ DebugPlugin.getDefault().asyncExec( runnable );
+ }
+
+ protected IWatchExpressionResult evaluationComplete( final String expression, final IValue value, final DebugException de ) {
+ return new IWatchExpressionResult() {
+
+ public IValue getValue() {
+ return value;
+ }
+
+ public boolean hasErrors() {
+ return ( de != null );
+ }
+
+ public String getExpressionText() {
+ return expression;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IWatchExpressionResult#getException()
+ */
+ public DebugException getException() {
+ return de;
+ }
+
+ public String[] getErrorMessages() {
+ return ( de != null ) ? new String[] { de.getMessage() } : new String[0];
+ }
+ };
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPluginResources.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPluginResources.properties
index e0b09f2b854..1e589b5471f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPluginResources.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPluginResources.properties
@@ -244,7 +244,7 @@ internal.ui.CDTDebugModelPresentation.threadName_Stepping={0} (Stepping)
internal.ui.CDTDebugModelPresentation.threadName_Running={0} (Running)
internal.ui.CDTDebugModelPresentation.Thread_threadName_suspended=Thread [{0}] (Suspended)
internal.ui.CDTDebugModelPresentation.Symbol_not_available=
-internal.ui.CDTDebugModelPresentation.disabled=
+internal.ui.CDTDebugModelPresentation.disabled=\ (disabled)
internal.ui.CDTDebugModelPresentation.Infinity=Infinity
internal.ui.CDTDebugModelPresentation.line=line:
internal.ui.CDTDebugModelPresentation.function=function: