From c8d69784d7255993218dca18c876e9e34f508b2f Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 10 Mar 2003 21:27:13 +0000 Subject: [PATCH] Use the 'isEditable' method of ICDIVariable instead of using types in the 'supportsModification' method. --- .../core/model/CModificationVariable.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModificationVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModificationVariable.java index 1ccb0bdb3e4..0842eccb2b7 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModificationVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CModificationVariable.java @@ -24,6 +24,8 @@ import org.eclipse.debug.core.model.IValue; */ public abstract class CModificationVariable extends CVariable { + private Boolean fEditable = null; + /** * Constructor for CModificationVariable. * @param parent @@ -39,30 +41,26 @@ public abstract class CModificationVariable extends CVariable */ public boolean supportsValueModification() { - CDebugTarget target = (CDebugTarget)getDebugTarget().getAdapter( CDebugTarget.class ); - if ( target == null || target.isCoreDumpTarget() ) + if ( fEditable == null ) { - return false; - } - - try - { - IValue value = getValue(); - if ( value != null && value instanceof ICValue ) + CDebugTarget target = (CDebugTarget)getDebugTarget().getAdapter( CDebugTarget.class ); + if ( target != null && !target.isCoreDumpTarget() ) { - switch( ((ICValue)value).getType() ) + try { - case ICValue.TYPE_POINTER: - return true; + fEditable = new Boolean( getCDIVariable().isEditable() ); } - return !( value.hasVariables() ); + catch( CDIException e ) + { + logError( e ); + } + } + else + { + fEditable = new Boolean( false ); } } - catch( DebugException e ) - { - logError( e ); - } - return false; + return ( fEditable != null ) ? fEditable.booleanValue() : false; } /**