Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Small Fixups


Hi!

Folks were nice enough to apply our patch for 1.2.1 to enable variable format setting for multiply selected variables as well as arrays.

Unfortunately, one thing was lost in the patch translation. In particular, right clicking a top level array object when there is more than one sub level underneath it (like say an array of 1000 ints) does not work correctly.

These changes make this case work without forcing array allocation (which is bad.)

Thanks!
-Chris
songer@xxxxxxxxxxxxx
director of platform engineering
voice: 408 327 7341 fax: 408 986 8919
diff -r -u xide/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java xide_compare/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
--- xide/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java	Mon Feb 23 13:39:21 2004
+++ xide_compare/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java	Mon Feb 23 13:41:15 2004
@@ -726,6 +726,28 @@
 	protected void doSetFormat( int format )
 	{
 		fFormat = format;
+		try{
+			IValue value = getValue();
+		
+			// this is special cased because arrays are sparse and requesting the 
+			// child variables forces allocation. The interface or array implementation needs
+			// to better support lazy values somehow.
+			if( value instanceof CArrayPartitionValue )
+			{
+				CArrayPartitionValue val = (CArrayPartitionValue)value;
+				if(!val.isCreated()) 
+					return;
+			}
+		
+			IVariable kids [] = getValue().getVariables();
+			for( int i = 0 ; i < kids.length ; i++ )
+			{
+				if( kids[i] instanceof CVariable )
+					((CVariable)kids[i]).setFormat(format);
+			}
+		} catch( DebugException e )
+		{
+		}
 	}
 
 	protected void reset() throws DebugException
diff -r -u xide/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java xide_compare/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java
--- xide/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java	Mon Feb 23 13:39:21 2004
+++ xide_compare/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java	Mon Feb 23 13:41:15 2004
@@ -106,13 +106,22 @@
 				if ( o instanceof ICVariable )
 				{
 					ICVariable var = (ICVariable)o;
-					boolean enabled = var.isEditable();
-					action.setEnabled( enabled );
-					if ( enabled )
+					if( ssel.size() == 1 && var.hasChildren() )
 					{
-						action.setChecked( var.getFormat() == fFormat );
+						action.setEnabled(true);
+						action.setChecked(false);
 						list.add(o);
 					}
+					else
+					{
+						boolean enabled = var.isEditable(); 
+						action.setEnabled( enabled );
+						if ( enabled )
+						{
+							action.setChecked( var.getFormat() == fFormat );
+							list.add(o);
+						}
+					}
 				}
 			}
 			setVariables( (ICVariable[])list.toArray( new ICVariable[list.size()] ) );


Back to the top