mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for PR 39087: Cache the MI answer once we know if the variable is writable.
This commit is contained in:
parent
269cca164e
commit
faf7bd9da2
2 changed files with 55 additions and 28 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-06-30 Mikhail Khodjaiants
|
||||||
|
Fix for PR 39087: Cache the MI answer once we know if the variable is writable.
|
||||||
|
* CVariable.java
|
||||||
|
|
||||||
2003-06-24 Mikhail Khodjaiants
|
2003-06-24 Mikhail Khodjaiants
|
||||||
All local var_objects are destroyed when a thread other than current is selected.
|
All local var_objects are destroyed when a thread other than current is selected.
|
||||||
CVariable has to be invalidated if a "destroyed" event has been received.
|
CVariable has to be invalidated if a "destroyed" event has been received.
|
||||||
|
|
|
@ -53,6 +53,10 @@ public abstract class CVariable extends CDebugElement
|
||||||
|
|
||||||
private ICDIVariable fCDIVariable;
|
private ICDIVariable fCDIVariable;
|
||||||
|
|
||||||
|
private Boolean fEditable = null;
|
||||||
|
|
||||||
|
private ICType fType = null;
|
||||||
|
|
||||||
public InternalVariable( ICDIVariableObject varObject )
|
public InternalVariable( ICDIVariableObject varObject )
|
||||||
{
|
{
|
||||||
setCDIVariableObject( varObject );
|
setCDIVariableObject( varObject );
|
||||||
|
@ -76,6 +80,28 @@ public abstract class CVariable extends CDebugElement
|
||||||
return fCDIVariableObject;
|
return fCDIVariableObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ICType getType() throws CDIException
|
||||||
|
{
|
||||||
|
if ( fType == null )
|
||||||
|
{
|
||||||
|
ICDIVariable var = getCDIVariable();
|
||||||
|
if ( var != null )
|
||||||
|
fType = new CType( var.getType() );
|
||||||
|
}
|
||||||
|
return fType;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isEditable() throws CDIException
|
||||||
|
{
|
||||||
|
if ( fEditable == null )
|
||||||
|
{
|
||||||
|
ICDIVariable var = getCDIVariable();
|
||||||
|
if ( var != null )
|
||||||
|
fEditable = new Boolean( var.isEditable() );
|
||||||
|
}
|
||||||
|
return ( fEditable != null ) ? fEditable.booleanValue() : false;
|
||||||
|
}
|
||||||
|
|
||||||
private void setCDIVariable( ICDIVariable variable )
|
private void setCDIVariable( ICDIVariable variable )
|
||||||
{
|
{
|
||||||
fCDIVariable = variable;
|
fCDIVariable = variable;
|
||||||
|
@ -98,6 +124,10 @@ public abstract class CVariable extends CDebugElement
|
||||||
logError( e.getMessage() );
|
logError( e.getMessage() );
|
||||||
}
|
}
|
||||||
setCDIVariable( null );
|
setCDIVariable( null );
|
||||||
|
if ( fType != null )
|
||||||
|
fType.dispose();
|
||||||
|
fType = null;
|
||||||
|
fEditable = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dispose()
|
protected void dispose()
|
||||||
|
@ -142,18 +172,11 @@ public abstract class CVariable extends CDebugElement
|
||||||
*/
|
*/
|
||||||
private String fQualifiedName = null;
|
private String fQualifiedName = null;
|
||||||
|
|
||||||
private Boolean fEditable = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change flag.
|
* Change flag.
|
||||||
*/
|
*/
|
||||||
protected boolean fChanged = false;
|
protected boolean fChanged = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of this variable.
|
|
||||||
*/
|
|
||||||
private ICType fType = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current format of this variable.
|
* The current format of this variable.
|
||||||
*/
|
*/
|
||||||
|
@ -674,20 +697,18 @@ public abstract class CVariable extends CDebugElement
|
||||||
{
|
{
|
||||||
if ( !isEnabled() )
|
if ( !isEnabled() )
|
||||||
return false;
|
return false;
|
||||||
if ( fEditable == null )
|
boolean result = false;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
InternalVariable var = getInternalVariable();
|
||||||
{
|
if ( var != null )
|
||||||
ICDIVariable var = getCDIVariable();
|
result = var.isEditable();
|
||||||
if ( var != null )
|
|
||||||
fEditable = new Boolean( var.isEditable() );
|
|
||||||
}
|
|
||||||
catch( CDIException e )
|
|
||||||
{
|
|
||||||
logError( e );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ( fEditable != null ) ? fEditable.booleanValue() : false;
|
catch( CDIException e )
|
||||||
|
{
|
||||||
|
logError( e );
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -759,20 +780,21 @@ public abstract class CVariable extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public ICType getType() throws DebugException
|
public ICType getType() throws DebugException
|
||||||
{
|
{
|
||||||
if ( isEnabled() && fType == null )
|
ICType type = null;
|
||||||
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICDIVariable var = getCDIVariable();
|
InternalVariable iv = getInternalVariable();
|
||||||
if ( var != null )
|
if ( iv != null )
|
||||||
fType = new CType( var.getType() );
|
type = iv.getType();
|
||||||
}
|
}
|
||||||
catch( CDIException e )
|
catch( CDIException e )
|
||||||
{
|
{
|
||||||
requestFailed( "Type is not available.", e );
|
requestFailed( "Type is not available.", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fType;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -809,10 +831,6 @@ public abstract class CVariable extends CDebugElement
|
||||||
((CValue)fValue).dispose();
|
((CValue)fValue).dispose();
|
||||||
fValue = null;
|
fValue = null;
|
||||||
}
|
}
|
||||||
fEditable = null;
|
|
||||||
if ( fType != null )
|
|
||||||
fType.dispose();
|
|
||||||
fType = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isArgument()
|
protected boolean isArgument()
|
||||||
|
@ -851,4 +869,9 @@ public abstract class CVariable extends CDebugElement
|
||||||
return ( ( getShadow() != null && getShadow().isSameVariable( cdiVar ) ) ||
|
return ( ( getShadow() != null && getShadow().isSameVariable( cdiVar ) ) ||
|
||||||
( fOriginal != null && fOriginal.isSameVariable( cdiVar ) ) );
|
( fOriginal != null && fOriginal.isSameVariable( cdiVar ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InternalVariable getInternalVariable()
|
||||||
|
{
|
||||||
|
return ( getShadow() != null ) ? getShadow() : fOriginal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue