Skip to main content
summaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2007-05-17 10:06:29 +0000
committerMikhail Khodjaiants2007-05-17 10:06:29 +0000
commitd110311f481e6f6f93e907fe3ffad11ff9becbbe (patch)
tree7eccb38fb6ead9638229e84e73916b4b1208cc7b /debug
parent585a40aa2b006f066a679c4e00c12433c7799968 (diff)
downloadorg.eclipse.cdt-d110311f481e6f6f93e907fe3ffad11ff9becbbe.tar.gz
org.eclipse.cdt-d110311f481e6f6f93e907fe3ffad11ff9becbbe.tar.xz
org.eclipse.cdt-d110311f481e6f6f93e907fe3ffad11ff9becbbe.zip
Bug 186981: Values of variables are shown differently depending on "show columns" option.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java21
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java7
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java91
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java114
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java16
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java54
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java84
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java13
8 files changed, 294 insertions, 106 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java
new file mode 100644
index 00000000000..4e619d63765
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICRegister.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 ARM Limited and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ARM Limited - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.core.model;
+
+import org.eclipse.debug.core.model.IRegister;
+
+/**
+ * C/C++ specific extension of <code>IRegister</code>.
+ * Added to be able to contribute a label provider.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
+ */
+public interface ICRegister extends ICVariable, IRegister {
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java
index ec7393f75a6..856493c6c74 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
+ * Copyright (c) 2000, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
@@ -29,19 +30,19 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
import org.eclipse.cdt.debug.core.model.CVariableFormat;
+import org.eclipse.cdt.debug.core.model.ICRegister;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.IRegisterDescriptor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IRegister;
import org.eclipse.debug.core.model.IRegisterGroup;
/**
* Represents a register in the CDI model.
*/
-public class CRegister extends CVariable implements IRegister {
+public class CRegister extends CVariable implements ICRegister {
private class InternalVariable implements IInternalVariable {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java
index 0f7defcb913..cb558cd55d3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software Systems and others.
+ * Copyright (c) 2004, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Nokia - Added support for CSourceNotFoundElement ( 167305 )
+ * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
@@ -58,7 +59,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugException;
@@ -338,20 +338,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
String bt = getBaseText( element );
if ( bt == null )
return null;
- StringBuffer baseText = new StringBuffer( bt );
- if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
- baseText.append( getFormattedString( " <{0}>", ((ICDebugElementStatus)element).getMessage() ) ); //$NON-NLS-1$
- }
- if ( element instanceof IAdaptable ) {
- IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
- if ( target != null ) {
- if ( !target.isEnabled() ) {
- baseText.append( ' ' );
- baseText.append( CDebugUIMessages.getString( "CDTDebugModelPresentation.25" ) ); //$NON-NLS-1$
- }
- }
- }
- return baseText.toString();
+ return CDebugUIUtils.decorateText( element, bt );
}
private String getBaseText( Object element ) {
@@ -541,30 +528,6 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
return null;
}
- private String getVariableTypeName( ICType type ) {
- StringBuffer result = new StringBuffer();
- String typeName = type.getName();
- if ( typeName != null )
- typeName = typeName.trim();
- if ( type.isArray() && typeName != null ) {
- int index = typeName.indexOf( '[' );
- if ( index != -1 )
- typeName = typeName.substring( 0, index ).trim();
- }
- if ( typeName != null && typeName.length() > 0 ) {
- result.append( typeName );
- if ( type.isArray() ) {
- int[] dims = type.getArrayDimensions();
- for( int i = 0; i < dims.length; ++i ) {
- result.append( '[' );
- result.append( dims[i] );
- result.append( ']' );
- }
- }
- }
- return result.toString();
- }
-
protected String getVariableText( IVariable var ) throws DebugException {
StringBuffer label = new StringBuffer();
if ( var instanceof ICVariable ) {
@@ -576,7 +539,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
// don't display type
}
if ( type != null && isShowVariableTypeNames() ) {
- String typeName = getVariableTypeName( type );
+ String typeName = CDebugUIUtils.getVariableTypeName( type );
if ( typeName != null && typeName.length() > 0 ) {
label.append( typeName ).append( ' ' );
}
@@ -593,48 +556,8 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
return label.toString();
}
- protected String getValueText( IValue value )/* throws DebugException*/ {
- StringBuffer label = new StringBuffer();
- if ( value instanceof ICDebugElementStatus && !((ICDebugElementStatus)value).isOK() ) {
- label.append( getFormattedString( CDebugUIMessages.getString( "CDTDebugModelPresentation.4" ), ((ICDebugElementStatus)value).getMessage() ) ); //$NON-NLS-1$
- }
- else if ( value instanceof ICValue ) {
- ICType type = null;
- try {
- type = ((ICValue)value).getType();
- }
- catch( DebugException e ) {
- }
- try {
- String valueString = value.getValueString();
- if ( valueString != null ) {
- valueString = valueString.trim();
- if ( type != null && type.isCharacter() ) {
- if ( valueString.length() == 0 )
- valueString = "."; //$NON-NLS-1$
- label.append( valueString );
- }
- else if ( type != null && type.isFloatingPointType() ) {
- Number floatingPointValue = CDebugUtils.getFloatingPointValue( (ICValue)value );
- if ( CDebugUtils.isNaN( floatingPointValue ) )
- valueString = "NAN"; //$NON-NLS-1$
- if ( CDebugUtils.isPositiveInfinity( floatingPointValue ) )
- valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.23" ); //$NON-NLS-1$
- if ( CDebugUtils.isNegativeInfinity( floatingPointValue ) )
- valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.24" ); //$NON-NLS-1$
- label.append( valueString );
- }
- else if ( type == null || (!type.isArray() && !type.isStructure()) ) {
- if ( valueString.length() > 0 ) {
- label.append( valueString );
- }
- }
- }
- }
- catch( DebugException e1 ) {
- }
- }
- return label.toString();
+ protected String getValueText( IValue value ) {
+ return CDebugUIUtils.getValueText( value );
}
protected String getSignalText( ICSignal signal ) {
@@ -664,7 +587,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
catch( DebugException e1 ) {
}
if ( type != null && isShowVariableTypeNames() ) {
- String typeName = getVariableTypeName( type );
+ String typeName = CDebugUIUtils.getVariableTypeName( type );
if ( !isEmpty( typeName ) ) {
result.insert( 0, typeName + ' ' );
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
index b0e051b671f..74f5b028d4a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
@@ -1,17 +1,28 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 QNX Software Systems and others.
+ * Copyright (c) 2000, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * QNX Software Systems - Initial API and implementation
+ * QNX Software Systems - Initial API and implementation
+ * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
+import org.eclipse.cdt.debug.core.model.ICType;
+import org.eclipse.cdt.debug.core.model.ICValue;
+import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -72,4 +83,103 @@ public class CDebugUIUtils {
IAdaptable context = DebugUITools.getDebugContext();
return ( context != null ) ? (ICStackFrame)context.getAdapter( ICStackFrame.class ) : null;
}
+
+ /**
+ * Moved from CDebugModelPresentation because it is also used by CVariableLabelProvider.
+ */
+ static public String getValueText( IValue value ) {
+ StringBuffer label = new StringBuffer();
+ if ( value instanceof ICDebugElementStatus && !((ICDebugElementStatus)value).isOK() ) {
+ label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.4" ), new String[] { ((ICDebugElementStatus)value).getMessage() } ) ); //$NON-NLS-1$
+ }
+ else if ( value instanceof ICValue ) {
+ ICType type = null;
+ try {
+ type = ((ICValue)value).getType();
+ }
+ catch( DebugException e ) {
+ }
+ try {
+ String valueString = value.getValueString();
+ if ( valueString != null ) {
+ valueString = valueString.trim();
+ if ( type != null && type.isCharacter() ) {
+ if ( valueString.length() == 0 )
+ valueString = "."; //$NON-NLS-1$
+ label.append( valueString );
+ }
+ else if ( type != null && type.isFloatingPointType() ) {
+ Number floatingPointValue = CDebugUtils.getFloatingPointValue( (ICValue)value );
+ if ( CDebugUtils.isNaN( floatingPointValue ) )
+ valueString = "NAN"; //$NON-NLS-1$
+ if ( CDebugUtils.isPositiveInfinity( floatingPointValue ) )
+ valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.23" ); //$NON-NLS-1$
+ if ( CDebugUtils.isNegativeInfinity( floatingPointValue ) )
+ valueString = CDebugUIMessages.getString( "CDTDebugModelPresentation.24" ); //$NON-NLS-1$
+ label.append( valueString );
+ }
+ else if ( type == null || (!type.isArray() && !type.isStructure()) ) {
+ if ( valueString.length() > 0 ) {
+ label.append( valueString );
+ }
+ }
+ }
+ }
+ catch( DebugException e1 ) {
+ }
+ }
+ return label.toString();
+ }
+
+ /**
+ * Moved from CDebugModelPresentation because it is also used by CVariableLabelProvider.
+ */
+ public static String getVariableTypeName( ICType type ) {
+ StringBuffer result = new StringBuffer();
+ if ( type != null ) {
+ String typeName = type.getName();
+ if ( typeName != null )
+ typeName = typeName.trim();
+ if ( type.isArray() && typeName != null ) {
+ int index = typeName.indexOf( '[' );
+ if ( index != -1 )
+ typeName = typeName.substring( 0, index ).trim();
+ }
+ if ( typeName != null && typeName.length() > 0 ) {
+ result.append( typeName );
+ if ( type.isArray() ) {
+ int[] dims = type.getArrayDimensions();
+ for( int i = 0; i < dims.length; ++i ) {
+ result.append( '[' );
+ result.append( dims[i] );
+ result.append( ']' );
+ }
+ }
+ }
+ }
+ return result.toString();
+ }
+
+ public static String getVariableName( IVariable variable ) throws DebugException {
+ return decorateText( variable, variable.getName() );
+ }
+
+ public static String decorateText( Object element, String text ) {
+ if ( text == null )
+ return null;
+ StringBuffer baseText = new StringBuffer( text );
+ if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
+ baseText.append( MessageFormat.format( " <{0}>", new String[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
+ }
+ if ( element instanceof IAdaptable ) {
+ IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
+ if ( target != null ) {
+ if ( !target.isEnabled() ) {
+ baseText.append( ' ' );
+ baseText.append( CDebugUIMessages.getString( "CDTDebugModelPresentation.25" ) ); //$NON-NLS-1$
+ }
+ }
+ }
+ return baseText.toString();
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java
index 4c7c9653566..f2cbef5587c 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* IBM Corporation
+ * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.elements.adapters;
@@ -15,21 +16,15 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.model.ICModule;
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider;
-import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleLabelProvider;
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider;
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleProxyFactory;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
-/**
- * Comment for .
- */
public class CDebugElementAdapterFactory implements IAdapterFactory {
- private static IElementLabelProvider fgModuleLabelProvider = new ModuleLabelProvider();
private static IElementContentProvider fgModuleContentProvider = new ModuleContentProvider();
private static IModelProxyFactory fgModuleProxyFactory = new ModuleProxyFactory();
private static IElementMementoProvider fgModuleMementoProvider = new ModuleMementoProvider();
@@ -41,14 +36,6 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
if ( adapterType.isInstance( adaptableObject ) ) {
return adaptableObject;
}
- if ( adapterType.equals( IElementLabelProvider.class ) ) {
- if ( adaptableObject instanceof ICModule ) {
- return fgModuleLabelProvider;
- }
- if ( adaptableObject instanceof ICElement ) {
- return fgModuleLabelProvider;
- }
- }
if ( adapterType.equals( IElementContentProvider.class ) ) {
if ( adaptableObject instanceof IModuleRetrieval ) {
return fgModuleContentProvider;
@@ -78,7 +65,6 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
*/
public Class[] getAdapterList() {
return new Class[] {
- IElementLabelProvider.class,
IElementContentProvider.class,
IModelProxyFactory.class,
IElementMementoProvider.class,
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java
new file mode 100644
index 00000000000..0de9403d919
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementLabelProviderFactory.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 ARM Limited and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ARM Limited - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.debug.core.model.ICModule;
+import org.eclipse.cdt.debug.core.model.ICVariable;
+import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleLabelProvider;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
+
+/**
+ * Factory for all (non-default) label providers
+ */
+public class CDebugElementLabelProviderFactory implements IAdapterFactory {
+
+ private static IElementLabelProvider fgModuleLabelProvider = new ModuleLabelProvider();
+ private static IElementLabelProvider fgVariableLabelProvider = new CVariableLabelProvider();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter( Object adaptableObject, Class adapterType ) {
+ if ( adapterType.equals( IElementLabelProvider.class ) ) {
+ if ( adaptableObject instanceof ICModule ) {
+ return fgModuleLabelProvider;
+ }
+ if ( adaptableObject instanceof ICElement ) {
+ return fgModuleLabelProvider;
+ }
+ if ( adaptableObject instanceof ICVariable ) {
+ return fgVariableLabelProvider;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] {
+ IElementLabelProvider.class,
+ };
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java
new file mode 100644
index 00000000000..56a0eb39166
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CVariableLabelProvider.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007 ARM Limited and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ARM Limited - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
+
+import org.eclipse.cdt.debug.core.model.ICValue;
+import org.eclipse.cdt.debug.core.model.ICVariable;
+import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnPresentation;
+import org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreePath;
+
+/**
+ * Label provider for variables and registers.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
+ *
+ * Using the internal platform classes because the API hasn't been defined.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=187500 and
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=187502
+ */
+public class CVariableLabelProvider extends DebugElementLabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String)
+ */
+ protected String getLabel( TreePath elementPath, IPresentationContext context, String columnId ) throws CoreException {
+ if ( columnId != null ) {
+ IVariable variable = (IVariable)elementPath.getLastSegment();
+ IValue value = variable.getValue();
+ return getColumnText( variable, value, context, columnId );
+ }
+ return super.getLabel( elementPath, context, columnId );
+ }
+
+ protected String getValueText( IVariable variable, IValue value, IPresentationContext context ) throws CoreException {
+ if ( value instanceof ICValue ) {
+ return CDebugUIUtils.getValueText( value );
+ }
+ return null;
+ }
+
+ protected String getVariableTypeName( IVariable variable, IPresentationContext context ) throws CoreException {
+ if ( variable instanceof ICVariable ) {
+ return CDebugUIUtils.getVariableTypeName( ((ICVariable)variable).getType() );
+ }
+ return null;
+ }
+
+ protected String getVariableName( IVariable variable, IPresentationContext context ) throws CoreException {
+ return CDebugUIUtils.getVariableName( variable );
+ }
+
+ protected String getColumnText( IVariable variable, IValue value, IPresentationContext context, String columnId ) throws CoreException {
+ if ( VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals( columnId ) ) {
+ return getVariableName( variable, context );
+ }
+ else if ( VariableColumnPresentation.COLUMN_VARIABLE_TYPE.equals( columnId ) ) {
+ return getVariableTypeName( variable, context );
+ }
+ else if ( VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals( columnId ) ) {
+ return getValueText( variable, value, context );
+ }
+ return null; // super.getColumnText( variable, value, context, columnId );
+ }
+
+ protected ImageDescriptor getImageDescriptor( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException {
+ if ( columnId == null || VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals( columnId ) ) {
+ return super.getImageDescriptor( elementPath, presentationContext, columnId );
+ }
+ return null; // super.getImageDescriptor( elementPath, presentationContext, columnId );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
index e5430d2b5b5..2eaa1e20280 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software Systems and others.
+ * Copyright (c) 2004, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
*******************************************************************************/
package org.eclipse.cdt.debug.ui;
@@ -16,6 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICModule;
+import org.eclipse.cdt.debug.core.model.ICRegister;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater;
@@ -26,6 +28,7 @@ import org.eclipse.cdt.debug.internal.ui.ColorManager;
import org.eclipse.cdt.debug.internal.ui.EvaluationContextManager;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
import org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory;
+import org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementLabelProviderFactory;
import org.eclipse.cdt.debug.internal.ui.elements.adapters.CMemoryAdapterFactory;
import org.eclipse.cdt.debug.internal.ui.elements.adapters.CWatchExpressionFactoryAdapterFactory;
import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator;
@@ -288,7 +291,13 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
manager.registerAdapters( elementAdapterFactory, IModuleRetrieval.class );
manager.registerAdapters( elementAdapterFactory, ICModule.class );
manager.registerAdapters( elementAdapterFactory, ICElement.class );
-
+
+ CDebugElementLabelProviderFactory labelProviderFactory = new CDebugElementLabelProviderFactory();
+ manager.registerAdapters( labelProviderFactory, ICVariable.class );
+ manager.registerAdapters( labelProviderFactory, ICRegister.class );
+ manager.registerAdapters( labelProviderFactory, ICModule.class );
+ manager.registerAdapters( labelProviderFactory, ICElement.class );
+
CWatchExpressionFactoryAdapterFactory watchExpressionAdapterFactory = new CWatchExpressionFactoryAdapterFactory();
manager.registerAdapters( watchExpressionAdapterFactory, ICVariable.class );

Back to the top