diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 8c0ad62c1b6..3d645817491 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,10 @@ +2002-12-16 Mikhail Khodjaiants + Added support of variable formatting. + * ICValue.java: new type - TYPE_UNKNOWN + * ICVariable: new interface for object contribution, set/get format and refresh methods + * CValue.java + * CVariable.java + 2002-12-13 Mikhail Khodjaiants Display message when 'getStackDepth' is timed out. * CThread.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICValue.java index 0604b3c79aa..5f3a1d17652 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICValue.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICValue.java @@ -18,6 +18,7 @@ import org.eclipse.debug.core.model.IValue; */ public interface ICValue extends IValue { + static final public int TYPE_UNKNOWN = -1; static final public int TYPE_SIMPLE = 0; static final public int TYPE_ARRAY = 1; static final public int TYPE_STRUCTURE = 2; diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java new file mode 100644 index 00000000000..66cd16da22b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java @@ -0,0 +1,24 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.core.model; + +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IVariable; + +/** + * + * Enter type comment. + * + * @since Dec 15, 2002 + */ +public interface ICVariable extends IVariable +{ + int getFormat(); + + void setFormat( int format ) throws DebugException; + + void refresh() throws DebugException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java index 3deac280899..1375dc5e9d1 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java @@ -50,7 +50,7 @@ public class CValue extends CDebugElement implements ICValue /** * Type (simple, array, structure or string) of this value. */ - private int fType = TYPE_SIMPLE; + private int fType = TYPE_UNKNOWN; /** * Constructor for CValue. @@ -198,7 +198,7 @@ public class CValue extends CDebugElement implements ICValue protected void calculateType( String stringValue ) { - if ( stringValue != null ) + if ( fType == TYPE_UNKNOWN && stringValue != null ) { stringValue = stringValue.trim(); if ( stringValue.length() == 0 ) @@ -221,6 +221,10 @@ public class CValue extends CDebugElement implements ICValue { fType = TYPE_POINTER; } + else + { + fType = TYPE_SIMPLE; + } } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java index 31d53358bfe..4e5308557f5 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java @@ -6,6 +6,7 @@ package org.eclipse.cdt.debug.internal.core.model; 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; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; @@ -13,6 +14,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; 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.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IDebugTarget; @@ -26,7 +28,7 @@ import org.eclipse.debug.core.model.IVariable; * @since Aug 9, 2002 */ public abstract class CVariable extends CDebugElement - implements IVariable, + implements ICVariable, ICDIEventListener { /** @@ -63,6 +65,11 @@ public abstract class CVariable extends CDebugElement */ private String fTypeName = null; + /** + * The current format of this variable. + */ + private int fFormat = ICDIFormat.NATURAL; + /** * Constructor for CVariable. * @param target @@ -153,6 +160,8 @@ public abstract class CVariable extends CDebugElement { if ( adapter.equals( IVariable.class ) ) return this; + if ( adapter.equals( ICVariable.class ) ) + return this; return super.getAdapter( adapter ); } @@ -349,4 +358,43 @@ public abstract class CVariable extends CDebugElement parentValue.getParentVariable().setChanged( true ); parentValue.getParentVariable().fireChangeEvent( DebugEvent.STATE ); } + + /** + * @see org.eclipse.cdt.debug.core.model.ICVariable#getFormat() + */ + public int getFormat() + { + return fFormat; + } + + /** + * @see org.eclipse.cdt.debug.core.model.ICVariable#setFormat(int) + */ + public void setFormat( int format ) throws DebugException + { + try + { + getCDIVariable().setFormat( format ); + fFormat = format; + } + catch( CDIException e ) + { + targetRequestFailed( e.getMessage(), null ); + } + } + + /** + * @see org.eclipse.cdt.debug.core.model.ICVariable#refresh() + */ + public void refresh() throws DebugException + { + try + { + getCDIVariable().setValue( getCDIVariable().getValue().getValueString() ); + } + catch( CDIException e ) + { + targetRequestFailed( e.getMessage(), null ); + } + } }