mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Core support of the "Display As Array" action.
This commit is contained in:
parent
c8d69784d7
commit
7c2c85ddb5
4 changed files with 67 additions and 33 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-03-09 Mikhail Khodjaiants
|
||||
Core support of the "Display As Array" action.
|
||||
* ICastToArray.java
|
||||
* CLocalVariable.java
|
||||
* CVariable.java
|
||||
|
||||
2003-03-09 Mikhail Khodjaiants
|
||||
Core support of the "Cast To Type" and "Restore Default Type" actions.
|
||||
* ICastToType.java: new
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.debug.core.model;
|
||||
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Mar 10, 2003
|
||||
*/
|
||||
public interface ICastToArray extends ICastToType
|
||||
{
|
||||
boolean supportsCastToArray();
|
||||
|
||||
void castToArray( String type, int startIndex, int endIndex ) throws DebugException;
|
||||
}
|
|
@ -6,9 +6,6 @@
|
|||
package org.eclipse.cdt.debug.internal.core.model;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IValue;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -18,36 +15,12 @@ import org.eclipse.debug.core.model.IValue;
|
|||
*/
|
||||
public class CLocalVariable extends CModificationVariable
|
||||
{
|
||||
/**
|
||||
* Constructor for CLocalVariable.
|
||||
* @param target
|
||||
*/
|
||||
public CLocalVariable( CDebugElement parent, ICDIVariable cdiVariable )
|
||||
{
|
||||
super( parent, cdiVariable );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICastToType#supportsCasting()
|
||||
*/
|
||||
public boolean supportsCasting()
|
||||
{
|
||||
boolean enabled = false;
|
||||
try
|
||||
{
|
||||
IValue value = getValue();
|
||||
if ( value instanceof ICValue )
|
||||
{
|
||||
switch( ((ICValue)value).getType() )
|
||||
{
|
||||
case ICValue.TYPE_SIMPLE:
|
||||
case ICValue.TYPE_POINTER:
|
||||
case ICValue.TYPE_CHAR:
|
||||
enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
logError( e );
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
import org.eclipse.cdt.debug.core.model.ICVariable;
|
||||
import org.eclipse.cdt.debug.core.model.ICastToArray;
|
||||
import org.eclipse.cdt.debug.core.model.ICastToType;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
@ -35,7 +36,8 @@ import org.eclipse.debug.core.model.IVariable;
|
|||
public abstract class CVariable extends CDebugElement
|
||||
implements ICVariable,
|
||||
ICDIEventListener,
|
||||
ICastToType
|
||||
ICastToType,
|
||||
ICastToArray
|
||||
{
|
||||
/**
|
||||
* The parent object this variable is contained in.
|
||||
|
@ -81,6 +83,15 @@ public abstract class CVariable extends CDebugElement
|
|||
*/
|
||||
private int fFormat = ICDIFormat.NATURAL;
|
||||
|
||||
/**
|
||||
* @param target
|
||||
*/
|
||||
public CVariable(CDebugTarget target)
|
||||
{
|
||||
super(target);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CVariable.
|
||||
* @param target
|
||||
|
@ -481,7 +492,7 @@ public abstract class CVariable extends CDebugElement
|
|||
*/
|
||||
public boolean supportsCasting()
|
||||
{
|
||||
return false;
|
||||
return supportsValueModification();
|
||||
}
|
||||
|
||||
protected ICDIVariable getOriginalCDIVariable()
|
||||
|
@ -534,4 +545,27 @@ public abstract class CVariable extends CDebugElement
|
|||
{
|
||||
return ( getShadow() != null );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(java.lang.String, int, int)
|
||||
*/
|
||||
public void castToArray( String type, int startIndex, int endIndex ) throws DebugException
|
||||
{
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICastToArray#supportsCastToArray()
|
||||
*/
|
||||
public boolean supportsCastToArray()
|
||||
{
|
||||
try
|
||||
{
|
||||
return ( supportsValueModification() && getValue().hasVariables() );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
logError( e );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue