Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Added support of variable formatting

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.76
diff -u -r1.76 ChangeLog
--- ChangeLog 13 Dec 2002 19:10:07 -0000 1.76
+++ ChangeLog 17 Dec 2002 02:40:25 -0000
@@ -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
Index: src/org/eclipse/cdt/debug/core/model/ICValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICValue.java,v
retrieving revision 1.2
diff -u -r1.2 ICValue.java
--- src/org/eclipse/cdt/debug/core/model/ICValue.java 4 Dec 2002 21:34:31 -0000 1.2
+++ src/org/eclipse/cdt/debug/core/model/ICValue.java 17 Dec 2002 02:40:25 -0000
@@ -18,6 +18,7 @@
  */
 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;
Index: src/org/eclipse/cdt/debug/core/model/ICVariable.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/model/ICVariable.java
diff -N src/org/eclipse/cdt/debug/core/model/ICVariable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/model/ICVariable.java 17 Dec 2002 02:40:25 -0000
@@ -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;
+}
Index: src/org/eclipse/cdt/debug/internal/core/model/CValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java,v
retrieving revision 1.12
diff -u -r1.12 CValue.java
--- src/org/eclipse/cdt/debug/internal/core/model/CValue.java 2 Dec 2002 23:22:22 -0000 1.12
+++ src/org/eclipse/cdt/debug/internal/core/model/CValue.java 17 Dec 2002 02:40:26 -0000
@@ -50,7 +50,7 @@
  /**
   * 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 @@
  
  protected void calculateType( String stringValue )
  {
-  if ( stringValue != null )
+  if ( fType == TYPE_UNKNOWN && stringValue != null )
   {
    stringValue = stringValue.trim();
    if ( stringValue.length() == 0 )
@@ -220,6 +220,10 @@
    else if ( stringValue.startsWith( "0x" ) )
    {
     fType = TYPE_POINTER;
+   }
+   else
+   {
+    fType = TYPE_SIMPLE;
    }
   }
  }
Index: src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java,v
retrieving revision 1.12
diff -u -r1.12 CVariable.java
--- src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 4 Dec 2002 21:34:31 -0000 1.12
+++ src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 17 Dec 2002 02:40:26 -0000
@@ -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.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 @@
  * @since Aug 9, 2002
  */
 public abstract class CVariable extends CDebugElement
-        implements IVariable,
+        implements ICVariable,
              ICDIEventListener
 {
  /**
@@ -64,6 +66,11 @@
  private String fTypeName = null;
 
  /**
+  * The current format of this variable.
+  */
+ private int fFormat = ICDIFormat.NATURAL;
+
+ /**
   * Constructor for CVariable.
   * @param target
   */
@@ -153,6 +160,8 @@
  {
   if ( adapter.equals( IVariable.class ) )
    return this;
+  if ( adapter.equals( ICVariable.class ) )
+   return this;
   return super.getAdapter( adapter );
  }
 
@@ -348,5 +357,44 @@
  {
   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 );
+  }
  }
 }

Back to the top