1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Restrict the "display as array" operation to the pointer types only.

This commit is contained in:
Mikhail Khodjaiants 2004-08-05 20:19:00 +00:00
parent ea1e4af9af
commit 9214f34e8d
2 changed files with 29 additions and 11 deletions

View file

@ -1,3 +1,7 @@
2004-08-05 Mikhail Khodjaiants
Restrict the "display as array" operation to the pointer types only.
* CVariable.java
2004-08-05 Mikhail Khodjaiants
Warning cleanup.
* CSharedLibraryManager.java

View file

@ -493,11 +493,19 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
/*
* (non-Javadoc)
* Allow this operation only for the pointer types (???).
*
* @see org.eclipse.cdt.debug.core.model.ICastToArray#canCastToArray()
*/
public boolean canCastToArray() {
return ( getOriginal() != null && isEnabled() );
ICType type;
try {
type = getType();
return ( getOriginal() != null && isEnabled() && type.isPointer() );
}
catch( DebugException e ) {
}
return false;
}
/*
@ -506,11 +514,14 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
* @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(int, int)
*/
public void castToArray( int startIndex, int length ) throws DebugException {
InternalVariable newVar = getOriginal().createShadow( startIndex, length );
if ( getShadow() != null )
getShadow().dispose();
setShadow( newVar );
fireChangeEvent( DebugEvent.STATE );
InternalVariable current = getCurrentInternalVariable();
if ( current != null ) {
InternalVariable newVar = current.createShadow( startIndex, length );
if ( getShadow() != null )
getShadow().dispose();
setShadow( newVar );
fireChangeEvent( DebugEvent.STATE );
}
}
/*
@ -592,11 +603,14 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
* @see org.eclipse.cdt.debug.core.model.ICastToType#cast(java.lang.String)
*/
public void cast( String type ) throws DebugException {
InternalVariable newVar = getOriginal().createShadow( type );
if ( getShadow() != null )
getShadow().dispose();
setShadow( newVar );
fireChangeEvent( DebugEvent.STATE );
InternalVariable current = getCurrentInternalVariable();
if ( current != null ) {
InternalVariable newVar = current.createShadow( type );
if ( getShadow() != null )
getShadow().dispose();
setShadow( newVar );
fireChangeEvent( DebugEvent.STATE );
}
}
/*