mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added support of variable formatting.
This commit is contained in:
parent
09a54af4e3
commit
d1e1638d2e
5 changed files with 87 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue