Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Core support of the "Display As Array" action

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.139
diff -u -r1.139 ChangeLog
--- ChangeLog 9 Mar 2003 22:45:33 -0000 1.139
+++ ChangeLog 10 Mar 2003 23:03:13 -0000
@@ -1,4 +1,10 @@
 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
  * CLocalVariable.java
Index: src/org/eclipse/cdt/debug/core/model/ICastToArray.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/model/ICastToArray.java
diff -N src/org/eclipse/cdt/debug/core/model/ICastToArray.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/model/ICastToArray.java 10 Mar 2003 23:03:13 -0000
@@ -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;
+}
Index: src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java,v
retrieving revision 1.6
diff -u -r1.6 CLocalVariable.java
--- src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java 9 Mar 2003 22:45:33 -0000 1.6
+++ src/org/eclipse/cdt/debug/internal/core/model/CLocalVariable.java 10 Mar 2003 23:03:13 -0000
@@ -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 @@
  */
 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;
- } 
 }
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.16
diff -u -r1.16 CVariable.java
--- src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 9 Mar 2003 23:11:41 -0000 1.16
+++ src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 10 Mar 2003 23:03:14 -0000
@@ -19,6 +19,7 @@
 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 @@
 public abstract class CVariable extends CDebugElement
         implements ICVariable,
              ICDIEventListener,
-             ICastToType
+             ICastToType,
+             ICastToArray
 {
  /**
   * The parent object this variable is contained in.
@@ -82,6 +84,15 @@
  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 boolean supportsCasting()
  {
-  return false;
+  return supportsValueModification();
  }
  
  protected ICDIVariable getOriginalCDIVariable()
@@ -533,5 +544,28 @@
  public boolean isCasted()
  {
   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;
  }
 }

Back to the top