1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Use the 'isEditable' method of ICDIVariable instead of using types in the 'supportsModification' method.

This commit is contained in:
Mikhail Khodjaiants 2003-03-10 21:27:13 +00:00
parent 31e5b4acc3
commit c8d69784d7

View file

@ -24,6 +24,8 @@ import org.eclipse.debug.core.model.IValue;
*/ */
public abstract class CModificationVariable extends CVariable public abstract class CModificationVariable extends CVariable
{ {
private Boolean fEditable = null;
/** /**
* Constructor for CModificationVariable. * Constructor for CModificationVariable.
* @param parent * @param parent
@ -39,30 +41,26 @@ public abstract class CModificationVariable extends CVariable
*/ */
public boolean supportsValueModification() public boolean supportsValueModification()
{ {
CDebugTarget target = (CDebugTarget)getDebugTarget().getAdapter( CDebugTarget.class ); if ( fEditable == null )
if ( target == null || target.isCoreDumpTarget() )
{ {
return false; CDebugTarget target = (CDebugTarget)getDebugTarget().getAdapter( CDebugTarget.class );
} if ( target != null && !target.isCoreDumpTarget() )
try
{
IValue value = getValue();
if ( value != null && value instanceof ICValue )
{ {
switch( ((ICValue)value).getType() ) try
{ {
case ICValue.TYPE_POINTER: fEditable = new Boolean( getCDIVariable().isEditable() );
return true;
} }
return !( value.hasVariables() ); catch( CDIException e )
{
logError( e );
}
}
else
{
fEditable = new Boolean( false );
} }
} }
catch( DebugException e ) return ( fEditable != null ) ? fEditable.booleanValue() : false;
{
logError( e );
}
return false;
} }
/** /**