diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 89f2e78e68c..fc4fe31bdca 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,12 @@
+2002-12-16 Mikhail Khodjaiants
+ New formating actions for variables, registers, and expressions
+ * VariableFormatActionDelegate.java
+ * DecVariableFormatActionDelegate.java
+ * HexVariableFormatActionDelegate.java
+ * NaturalVariableFormatActionDelegate.java
+ * plugin.xml
+ * plugin.properties
+
2002-12-10 Mikhail Khodjaiants
Added new case in the 'getEditorInput' method of CDTDebugModelPresentation for FileStorage objects.
* CDTDebugModelPresentation.java
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index 9cfcc44d4fe..854ec794cfd 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -40,4 +40,9 @@ ShowFullPathsAction.tooltip=Show Full Paths
AddGlobalsAction.label=Add Global Variables...
AddGlobalsAction.tooltip=Add Global Variables
+CVariableFormatMenu.label=Format
+HexVariableFormatAction.label=Hexadecimal
+DecVariableFormatAction.label=Decimal
+NaturalVariableFormatAction.label=Natural
+
CDebugActionGroup.name=C/C++ Debug
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index a4d02dcbdd5..fea5cceb618 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -481,6 +481,42 @@
+
+
+
+
+
+
+
+
+
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java
new file mode 100644
index 00000000000..7689f339761
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DecVariableFormatActionDelegate.java
@@ -0,0 +1,27 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Dec 16, 2002
+ */
+public class DecVariableFormatActionDelegate extends VariableFormatActionDelegate
+{
+
+ /**
+ * Constructor for DecVariableFormatActionDelegate.
+ * @param format
+ */
+ public DecVariableFormatActionDelegate()
+ {
+ super( ICDIFormat.DECIMAL );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java
new file mode 100644
index 00000000000..ebd682fc882
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/HexVariableFormatActionDelegate.java
@@ -0,0 +1,26 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Dec 16, 2002
+ */
+public class HexVariableFormatActionDelegate extends VariableFormatActionDelegate
+{
+ /**
+ * Constructor for HexVariableFormatActionDelegate.
+ * @param format
+ */
+ public HexVariableFormatActionDelegate()
+ {
+ super( ICDIFormat.HEXADECIMAL );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java
new file mode 100644
index 00000000000..d803b75623a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/NaturalVariableFormatActionDelegate.java
@@ -0,0 +1,27 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Dec 16, 2002
+ */
+public class NaturalVariableFormatActionDelegate extends VariableFormatActionDelegate
+{
+ /**
+ * Constructor for NaturalVariableFormatActionDelegate.
+ * @param format
+ */
+ public NaturalVariableFormatActionDelegate()
+ {
+ super( ICDIFormat.NATURAL );
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java
new file mode 100644
index 00000000000..e124c66a617
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java
@@ -0,0 +1,155 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
+import org.eclipse.cdt.debug.core.model.ICValue;
+import org.eclipse.cdt.debug.core.model.ICVariable;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Dec 16, 2002
+ */
+public class VariableFormatActionDelegate implements IObjectActionDelegate
+{
+ private int fFormat = ICDIFormat.DECIMAL;
+ private ICVariable fVariable = null;
+
+ /**
+ * Constructor for VariableFormatActionDelegate.
+ */
+ public VariableFormatActionDelegate( int format )
+ {
+ fFormat = format;
+ }
+
+ /**
+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart( IAction action, IWorkbenchPart targetPart )
+ {
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(IAction)
+ */
+ public void run( IAction action )
+ {
+ if ( getVariable() != null )
+ {
+ final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, "", null );
+ BusyIndicator.showWhile( Display.getCurrent(),
+ new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ doAction( getVariable() );
+ }
+ catch( DebugException e )
+ {
+ ms.merge( e.getStatus() );
+ }
+ }
+ } );
+ if ( !ms.isOK() )
+ {
+ IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
+ if ( window != null )
+ {
+ CDebugUIPlugin.errorDialog( "Unable to set format of variable.", ms );
+ }
+ else
+ {
+ CDebugUIPlugin.log( ms );
+ }
+ }
+
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ if ( selection instanceof IStructuredSelection )
+ {
+ Object element = ((IStructuredSelection)selection).getFirstElement();
+ if ( element instanceof ICVariable )
+ {
+ boolean enabled = enablesFor( (ICVariable)element );
+ action.setEnabled( enabled );
+ if ( enabled )
+ {
+ action.setChecked( ( ((ICVariable)element).getFormat() == fFormat ) );
+ setVariable( (ICVariable)element );
+ return;
+ }
+ }
+ }
+ action.setChecked( false );
+ action.setEnabled( false );
+ setVariable( null );
+ }
+
+ private boolean enablesFor( ICVariable var )
+ {
+ boolean enabled = false;
+ try
+ {
+ IValue value = var.getValue();
+ if ( value != null && value instanceof ICValue )
+ {
+ switch( ((ICValue)value).getType() )
+ {
+ case ICValue.TYPE_ARRAY:
+ case ICValue.TYPE_SIMPLE:
+ case ICValue.TYPE_POINTER:
+ enabled = true;
+ break;
+ }
+ }
+
+ }
+ catch( DebugException e )
+ {
+ }
+ return enabled;
+ }
+
+ private void setVariable( ICVariable var )
+ {
+ fVariable = var;
+ }
+
+ protected ICVariable getVariable()
+ {
+ return fVariable;
+ }
+
+ protected void doAction( ICVariable var ) throws DebugException
+ {
+ var.setFormat( fFormat );
+ var.refresh();
+ }
+}