mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Implementing the core support of the detail panel.
This commit is contained in:
parent
0fe28a9c96
commit
152f3b0dc3
6 changed files with 120 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
2003-06-04 Mikhail Khodjaiants
|
||||
Implementing the core support of the detail panel.
|
||||
* ICValue.java
|
||||
* ICVariable.java
|
||||
* CArrayPartitionValue.java
|
||||
* CValue.java
|
||||
* CVariable.java
|
||||
|
||||
2003-06-04 Mikhail Khodjaiants
|
||||
Added the processing of reference values.
|
||||
* CValue.java
|
||||
|
|
|
@ -23,5 +23,12 @@ public interface ICValue extends IValue
|
|||
*/
|
||||
ICDIValue getUnderlyingValue();
|
||||
|
||||
/**
|
||||
* Returns the string representation of the underlying CDI value for this value.
|
||||
*/
|
||||
String getUnderlyingValueString();
|
||||
|
||||
String computeDetail();
|
||||
|
||||
void setChanged( boolean changed ) throws DebugException;
|
||||
}
|
||||
|
|
|
@ -37,4 +37,8 @@ public interface ICVariable extends IVariable
|
|||
boolean isFloatingPointType();
|
||||
|
||||
boolean isNaN();
|
||||
|
||||
boolean isPointer();
|
||||
|
||||
String getQualifiedName() throws DebugException;
|
||||
}
|
||||
|
|
|
@ -136,4 +136,20 @@ public class CArrayPartitionValue extends CDebugElement implements ICValue
|
|||
((CVariable)it.next()).setChanged( changed );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICValue#getUnderlyingValueString()
|
||||
*/
|
||||
public String getUnderlyingValueString()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICValue#computeDetail()
|
||||
*/
|
||||
public String computeDetail()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDILongValue;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIShortValue;
|
||||
import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IVariable;
|
||||
|
@ -272,7 +273,7 @@ public class CValue extends CDebugElement implements ICValue
|
|||
}
|
||||
}
|
||||
|
||||
protected CVariable getParentVariable()
|
||||
public CVariable getParentVariable()
|
||||
{
|
||||
return fParent;
|
||||
}
|
||||
|
@ -512,4 +513,46 @@ public class CValue extends CDebugElement implements ICValue
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICValue#getUnderlyingValueString()
|
||||
*/
|
||||
public String getUnderlyingValueString()
|
||||
{
|
||||
String valueString = null;
|
||||
if ( getUnderlyingValue() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
valueString = getUnderlyingValue().getValueString();
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
valueString = e.getMessage();
|
||||
}
|
||||
}
|
||||
return valueString;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICValue#computeDetail()
|
||||
*/
|
||||
public String computeDetail()
|
||||
{
|
||||
ICExpressionEvaluator ee = (ICExpressionEvaluator)getDebugTarget().getAdapter( ICExpressionEvaluator.class );
|
||||
String valueString = null;
|
||||
if ( ee != null && ee.canEvaluate() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( getParentVariable() != null && !getParentVariable().isAccessSpecifier() )
|
||||
valueString = ee.evaluateExpressionToString( getParentVariable().getQualifiedName() );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
valueString = e.getMessage();
|
||||
}
|
||||
}
|
||||
return valueString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
package org.eclipse.cdt.debug.internal.core.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
|
||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
||||
|
@ -20,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
|
@ -610,9 +613,9 @@ public abstract class CVariable extends CDebugElement
|
|||
return ( fEditable != null ) ? fEditable.booleanValue() : false;
|
||||
}
|
||||
|
||||
protected boolean isPointer()
|
||||
public boolean isPointer()
|
||||
{
|
||||
return isEditable() && hasChildren();
|
||||
return ( getType() instanceof ICDIPointerType );
|
||||
}
|
||||
|
||||
public boolean isArray()
|
||||
|
@ -689,4 +692,40 @@ public abstract class CVariable extends CDebugElement
|
|||
{
|
||||
return ( getType() instanceof ICDIFloatingPointType );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICVariable#getQualifiedName()
|
||||
*/
|
||||
public String getQualifiedName() throws DebugException
|
||||
{
|
||||
LinkedList list = new LinkedList();
|
||||
list.add( this );
|
||||
CVariable var = null;
|
||||
CDebugElement element = getParent();
|
||||
while ( element instanceof CValue )
|
||||
{
|
||||
var = ((CValue)element).getParentVariable();
|
||||
if ( var == null )
|
||||
break;
|
||||
if ( !( var instanceof CArrayPartition ) && !var.isAccessSpecifier() )
|
||||
list.addFirst( var );
|
||||
element = var.getParent();
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
CVariable[] vars = (CVariable[])list.toArray( new CVariable[list.size()] );
|
||||
for ( int i = 0; i < vars.length; ++i )
|
||||
{
|
||||
sb.insert( 0, '(' );
|
||||
if ( i > 0 )
|
||||
sb.append( ( vars[i - 1].isPointer() ) ? "->" : "." );
|
||||
sb.append( vars[i].getName() );
|
||||
sb.append( ')' );
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected boolean isAccessSpecifier() throws DebugException
|
||||
{
|
||||
return ( "public".equals( getName() ) || "protected".equals( getName() ) || "private".equals( getName() ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue