1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-14 03:35:37 +02:00

Added the 'isEditable' and 'hasChildren' methods to the 'ICVariable' interface.

This commit is contained in:
Mikhail Khodjaiants 2003-03-14 23:12:21 +00:00
parent fa3f6e5e4c
commit e05bf9e181
4 changed files with 50 additions and 28 deletions

View file

@ -1,3 +1,9 @@
2003-03-14 Mikhail Khodjaiants
Added the 'isEditable' and 'hasChildren' methods to the 'ICVariable' interface.
* ICVariable.java
* CVariable.java
* CModificationVariable.java
2003-03-14 Mikhail Khodjaiants
Cross-referencing projects cause the debugger to go into a stack overflow exception.
Make sure that there is only one source location for each referenced project.

View file

@ -21,4 +21,8 @@ public interface ICVariable extends IVariable
void setFormat( int format ) throws DebugException;
void refresh() throws DebugException;
boolean isEditable();
boolean hasChildren();
}

View file

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

View file

@ -57,6 +57,8 @@ public abstract class CVariable extends CDebugElement
*/
protected ICValue fValue;
private Boolean fEditable = null;
/**
* Counter corresponding to this variable's debug target
* suspend count indicating the last time this value
@ -436,6 +438,7 @@ public abstract class CVariable extends CDebugElement
((CValue)fValue).dispose();
fValue = null;
}
fEditable = null;
fTypeName = null;
fireChangeEvent( DebugEvent.STATE );
}
@ -471,6 +474,7 @@ public abstract class CVariable extends CDebugElement
((CValue)fValue).dispose();
fValue = null;
}
fEditable = null;
fTypeName = null;
fireChangeEvent( DebugEvent.STATE );
}
@ -480,7 +484,8 @@ public abstract class CVariable extends CDebugElement
*/
public boolean supportsCasting()
{
return supportsValueModification();
CDebugTarget target = (CDebugTarget)getDebugTarget().getAdapter( CDebugTarget.class );
return ( target != null && isEditable() );
}
protected ICDIVariable getOriginalCDIVariable()
@ -502,8 +507,7 @@ public abstract class CVariable extends CDebugElement
{
try
{
ICDIVariableObject originalVarObject = getCDISession().getVariableManager().getVariableObject( cdiFrame, getOriginalCDIVariable().getName() );
ICDIVariableObject varObject = getCDISession().getVariableManager().getVariableObjectAsType( originalVarObject, type );
ICDIVariableObject varObject = getCDISession().getVariableManager().getVariableObjectAsType( getOriginalCDIVariable(), type );
return getCDISession().getVariableManager().createVariable( varObject );
}
catch( CDIException e )
@ -517,8 +521,7 @@ public abstract class CVariable extends CDebugElement
{
try
{
ICDIVariableObject originalVarObject = getCDISession().getVariableManager().getVariableObject( cdiFrame, getOriginalCDIVariable().getName() );
ICDIVariableObject varObject = getCDISession().getVariableManager().getVariableObjectAsArray( originalVarObject, type, start, end );
ICDIVariableObject varObject = getCDISession().getVariableManager().getVariableObjectAsArray( getOriginalCDIVariable(), type, start, end );
return getCDISession().getVariableManager().createVariable( varObject );
}
catch( CDIException e )
@ -572,6 +575,7 @@ public abstract class CVariable extends CDebugElement
((CValue)fValue).dispose();
fValue = null;
}
fEditable = null;
fTypeName = null;
fireChangeEvent( DebugEvent.STATE );
}
@ -581,10 +585,19 @@ public abstract class CVariable extends CDebugElement
* @see org.eclipse.cdt.debug.core.model.ICastToArray#supportsCastToArray()
*/
public boolean supportsCastToArray()
{
CDebugTarget target = (CDebugTarget)getDebugTarget().getAdapter( CDebugTarget.class );
return ( target != null && isEditable() && hasChildren() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICVariable#hasChildren()
*/
public boolean hasChildren()
{
try
{
return ( supportsValueModification() && getValue().hasVariables() );
return ( getValue() != null && getValue().hasVariables() );
}
catch( DebugException e )
{
@ -592,4 +605,23 @@ public abstract class CVariable extends CDebugElement
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICVariable#isEditable()
*/
public boolean isEditable()
{
if ( fEditable == null )
{
try
{
fEditable = new Boolean( getCDIVariable().isEditable() );
}
catch( CDIException e )
{
logError( e );
}
}
return ( fEditable != null ) ? fEditable.booleanValue() : false;
}
}