From 67777ab3911ea8e85f348ad71ba15c30e75b78db Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Fri, 24 Apr 2009 14:43:04 +0000 Subject: [PATCH] Bugzilla 272369 --- .../register/MessagesForRegisterVM.java | 7 +- .../register/RegisterBitFieldVMNode.java | 245 ++++++++++++++++-- .../ui/viewmodel/register/RegisterVMNode.java | 208 +++++++++++++-- .../ui/viewmodel/register/messages.properties | 43 ++- .../variable/MessagesForVariablesVM.java | 2 + .../ui/viewmodel/variable/VariableVMNode.java | 192 ++++++++++++-- .../ui/viewmodel/variable/messages.properties | 33 ++- 7 files changed, 642 insertions(+), 88 deletions(-) diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/MessagesForRegisterVM.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/MessagesForRegisterVM.java index 9a53f5439a8..99bdeacdc8a 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/MessagesForRegisterVM.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/MessagesForRegisterVM.java @@ -34,18 +34,19 @@ public class MessagesForRegisterVM extends NLS { public static String RegisterVMNode_Expression_column__text_format; public static String RegisterVMNode_Type_column__text_format; public static String RegisterVMNode_No_columns__text_format; + public static String RegisterVMNode_No_columns__text_format_with_type; public static String RegisterVMNode_No_columns__Error__text_format; - + public static String RegisterBitFieldVMNode_Name_column__text_format; public static String RegisterBitFieldVMNode_Description_column__text_format; public static String RegisterBitFieldVMNode_Type_column__text_format; public static String RegisterBitFieldVMNode_Value_column__With_mnemonic__text_format; public static String RegisterBitFieldVMNode_Expression_column__text_format; public static String RegisterBitFieldVMNode_No_columns__text_format; + public static String RegisterBitFieldVMNode_No_columns__text_format_with_type; public static String RegisterBitFieldVMNode_No_columns__With_mnemonic__text_format; + public static String RegisterBitFieldVMNode_No_columns__With_mnemonic__text_format_with_type; public static String RegisterBitFieldVMNode_No_columns__Error__text_format; - - static { // initialize resource bundle diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterBitFieldVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterBitFieldVMNode.java index fd37a7c9733..5fe18f559c9 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterBitFieldVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterBitFieldVMNode.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.dsf.debug.ui.viewmodel.register; +import java.lang.reflect.Method; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.RejectedExecutionException; @@ -74,6 +76,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.jface.util.PropertyChangeEvent; @@ -88,6 +91,11 @@ import org.eclipse.swt.widgets.Composite; public class RegisterBitFieldVMNode extends AbstractExpressionVMNode implements IElementEditor, IElementLabelProvider, IElementMementoProvider, IElementPropertiesProvider { + /** + * @since 2.0 + */ + private static final String PROP_BITFIELD_SHOW_TYPE_NAMES = "bitfield_show_type_names"; //$NON-NLS-1$ + protected class BitFieldVMC extends DMVMContext implements IFormattedValueVMContext { @@ -179,6 +187,26 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode return "RegisterBitFieldVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } + private Object[] constructTypeObjects( Map properties ) { + int readAttr = 0; + if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READABLE)) ) { + readAttr = 1; + } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READONCE)) ) { + readAttr = 2; + } + + int writeAttr = 0; + if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEABLE)) ) { + writeAttr = 1; + } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEONCE)) ) { + writeAttr = 2; + } + + Object[] messageAttrs = new Object[] { readAttr, writeAttr }; + + return messageAttrs; + } + /** * Creates the label provider delegate. This VM node will delegate label * updates to this provider which can be created by sub-classes. @@ -220,27 +248,14 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode new LabelText( MessagesForRegisterVM.RegisterBitFieldVMNode_Type_column__text_format, new String[] { - IRegisterVMConstants.PROP_IS_READABLE, IRegisterVMConstants.PROP_IS_READONCE, - IRegisterVMConstants.PROP_IS_WRITEABLE, IRegisterVMConstants.PROP_IS_WRITEONCE - }) + IRegisterVMConstants.PROP_IS_READABLE, + IRegisterVMConstants.PROP_IS_READONCE, + IRegisterVMConstants.PROP_IS_WRITEABLE, + IRegisterVMConstants.PROP_IS_WRITEONCE}) { @Override public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map properties) { - int readAttr = 0; - if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READABLE)) ) { - readAttr = 1; - } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READONCE)) ) { - readAttr = 2; - } - - int writeAttr = 0; - if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEABLE)) ) { - writeAttr = 1; - } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEONCE)) ) { - writeAttr = 2; - } - - Object[] messageAttrs = new Object[] { readAttr, writeAttr }; + Object[] messageAttrs = constructTypeObjects( properties ); try { update.setLabel(getMessageFormat().format( messageAttrs, new StringBuffer(), null).toString(), columnIndex); @@ -325,12 +340,108 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode new String[] { PROP_NAME, IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, - IRegisterVMConstants.PROP_CURRENT_MNEMONIC_LONG_NAME}), + IRegisterVMConstants.PROP_CURRENT_MNEMONIC_LONG_NAME}) + { + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_BITFIELD_SHOW_TYPE_NAMES); + return + showTypeNames != null && + !showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, new FormattedValueLabelText( - MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__With_mnemonic__text_format, + MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__With_mnemonic__text_format_with_type, new String[] { PROP_NAME, - IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE}), + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, + IRegisterVMConstants.PROP_CURRENT_MNEMONIC_LONG_NAME, + IRegisterVMConstants.PROP_IS_READABLE, + IRegisterVMConstants.PROP_IS_READONCE, + IRegisterVMConstants.PROP_IS_WRITEABLE, + IRegisterVMConstants.PROP_IS_WRITEONCE, + PROP_BITFIELD_SHOW_TYPE_NAMES}) + { + @Override + public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map properties) { + Object[] messageAttrs = constructTypeObjects( properties ); + Object[] combinedAttrs = new Object[ messageAttrs.length + 3 ]; + combinedAttrs[0] = super.getPropertyValue(PROP_NAME, status, properties); + combinedAttrs[1] = super.getPropertyValue(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, status, properties); + combinedAttrs[2] = super.getPropertyValue(IRegisterVMConstants.PROP_CURRENT_MNEMONIC_LONG_NAME, status, properties); + for ( int idx = 0 ; idx < messageAttrs.length; idx ++ ) { + combinedAttrs[ idx + 3 ] = messageAttrs[ idx ]; + } + + try { + update.setLabel(getMessageFormat().format(combinedAttrs, new StringBuffer(), null).toString(), columnIndex); + } catch (IllegalArgumentException e) { + update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, 0, "Failed formatting a message for column " + columnIndex + ", for update " + update, e)); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_BITFIELD_SHOW_TYPE_NAMES); + return + showTypeNames != null && + showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, + new FormattedValueLabelText( + MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__text_format, + new String[] { + PROP_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE}) + { + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_BITFIELD_SHOW_TYPE_NAMES); + return + showTypeNames != null && + !showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, + new FormattedValueLabelText( + MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__text_format_with_type, + new String[] { + PROP_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, + IRegisterVMConstants.PROP_IS_READABLE, + IRegisterVMConstants.PROP_IS_READONCE, + IRegisterVMConstants.PROP_IS_WRITEABLE, + IRegisterVMConstants.PROP_IS_WRITEONCE, + PROP_BITFIELD_SHOW_TYPE_NAMES}) + { + @Override + public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map properties) { + Object[] messageAttrs = constructTypeObjects( properties ); + Object[] combinedAttrs = new Object[ messageAttrs.length + 2 ]; + combinedAttrs[0] = super.getPropertyValue(PROP_NAME, status, properties); + combinedAttrs[1] = super.getPropertyValue(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, status, properties); + for ( int idx = 0 ; idx < messageAttrs.length; idx ++ ) { + combinedAttrs[ idx + 2 ] = messageAttrs[ idx ]; + } + + try { + update.setLabel(getMessageFormat().format(combinedAttrs, new StringBuffer(), null).toString(), columnIndex); + } catch (IllegalArgumentException e) { + update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, 0, "Failed formatting a message for column " + columnIndex + ", for update " + update, e)); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_BITFIELD_SHOW_TYPE_NAMES); + return + showTypeNames != null && + showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, new ErrorLabelText( MessagesForRegisterVM.RegisterBitFieldVMNode_No_columns__Error__text_format, new String[] { PROP_NAME }), @@ -401,6 +512,93 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode } } + // + // We encapsulate the determination of the state of the "Show Type Names" ICON + // selection to this routine. This attribute information is not readily available + // from standard Interface definitions. So we use reflection to get the info. But + // in the future this will change and then we can just change this routine. This + // really should just be as simple as the code below, which could be done inline + // once it comes to pass. + // + // Boolean attribute = (Boolean) context.getProperty(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES); + // if (attribute != null) { + // return attribute; + // } + // return Boolean.FALSE; + // + // @param return-value Boolean.TRUE --> Show Types ICON is selected/depressed + // @param return-value Boolean.FALSE --> Show Types ICON is not selected/depressed + // + + @SuppressWarnings("unchecked") + private Boolean getShowTypeNamesState( IPresentationContext context ) { + // This is fairly ugly stuff. It should be the case that the "getPropery()" + // method of the presentation context should contain this attribute, but it + // does not. So we have to go mining for it. As it turns out the presentation + // context is actually an implementation class DebugModelPresentationContext + // from which you can get the IDebugModelPresentation instance. In turn this + // is a DelegatingModelPresentation instance which allows you to obtain the + // current set of internal attributes, which contains the current state of + // "Show Type Names" ICON selection. + Class contextClass = context.getClass(); + Method contextMethod = null; + try { + // Will return the instance of the class "DebugModelPresentationContext" + // if this is indeed the implementation we are expecting. + contextMethod = contextClass.getMethod( "getModelPresentation" , new Class[] {} ); //$NON-NLS-1$ + } + catch ( Exception ex ) {} + + IDebugModelPresentation debugModelPresentation = null ; + if (contextMethod != null) { + try { + // We invoke the "getModelPresntation" method to get the actual instance + // of the "DelegatingModelPresentation". + debugModelPresentation = (IDebugModelPresentation) contextMethod.invoke(context , new Object[0]); + } + catch ( Exception e ) {} + } + + if (debugModelPresentation != null) { + Class presentationClass = debugModelPresentation.getClass(); + Method presentationMethod = null; + try { + // The "getAttributeMethod" is a public method which returns the internal + // attributes. These should be part of the Interface but they are not. So + // we get them through this available method. + presentationMethod = presentationClass.getMethod( "getAttributeMap" , new Class[] {} ); //$NON-NLS-1$ + } + catch ( Exception ex ) {} + + HashMap attributeMap = null; + if (presentationMethod != null) { + try { + // Now get the actual HashMap attribute list so we can see if there is + // state information about the "Show Type Names" ICON. + attributeMap = (HashMap) presentationMethod.invoke(debugModelPresentation , new Object[0]); + } + catch ( Exception e ) {} + } + + if (attributeMap != null) { + // This attribute ( which is globally defined ) reflect the state of the ICON. + // If is exists is contains the current state. Non-existence would mean that + // the ICON has never been selected or changed. This is so at the very start + // when the view is first brought up. + Boolean attribute = (Boolean) attributeMap.get(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES); + + if (attribute != null) { + return attribute; + } + } + } + + // Could not get to the one of the methods needs to determine the state of the + // ICON or we could not get the attribute. Assume we are not showing the TYPE + // NAMES. + return Boolean.FALSE; + } + /** * @since 2.0 */ @@ -429,6 +627,11 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode update.setProperty(AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION, expression.getExpressionText()); } + // Capture the current "Show Type Names" ICON state in case there are no columns. + if (update.getProperties().contains(PROP_BITFIELD_SHOW_TYPE_NAMES)) { + update.setProperty(PROP_BITFIELD_SHOW_TYPE_NAMES, getShowTypeNamesState(update.getPresentationContext())); + } + IBitFieldDMContext dmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IBitFieldDMContext.class); if (dmc == null || service == null) { handleFailedUpdate(update); diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java index 13a46f6f7b2..fe1f1295402 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.dsf.debug.ui.viewmodel.register; +import java.lang.reflect.Method; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.RejectedExecutionException; @@ -71,6 +73,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.jface.util.PropertyChangeEvent; @@ -87,6 +90,11 @@ import org.eclipse.swt.widgets.Composite; public class RegisterVMNode extends AbstractExpressionVMNode implements IElementEditor, IElementLabelProvider, IElementMementoProvider, IElementPropertiesProvider { + /** + * @since 2.0 + */ + private static final String PROP_REGISTER_SHOW_TYPE_NAMES = "register_show_type_names"; //$NON-NLS-1$ + protected class RegisterVMC extends DMVMContext implements IFormattedValueVMContext { @@ -170,6 +178,29 @@ public class RegisterVMNode extends AbstractExpressionVMNode fLabelProvider = createLabelProvider(); } + private Object[] constructTypeObjects( Map properties ) { + int type = 0; + if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_FLOAT)) ) { + type = 1; + } + + int readAttr = 0; + if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READABLE)) ) { + readAttr = 1; + } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READONCE)) ) { + readAttr = 2; + } + + int writeAttr = 0; + if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEABLE)) ) { + writeAttr = 1; + } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEONCE)) ) { + writeAttr = 2; + } + Object[] messageAttrs = new Object[] { type, readAttr, writeAttr }; + return messageAttrs; + } + /** * Creates the label provider delegate. This VM node will delegate label * updates to this provider which can be created by sub-classes. @@ -177,7 +208,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode * @return Returns the label provider for this node. * * @since 2.0 - */ + */ + protected IElementLabelProvider createLabelProvider() { PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider(); @@ -211,35 +243,18 @@ public class RegisterVMNode extends AbstractExpressionVMNode new LabelText( MessagesForRegisterVM.RegisterVMNode_Type_column__text_format, new String[] { - IRegisterVMConstants.PROP_IS_FLOAT, IRegisterVMConstants.PROP_IS_READABLE, IRegisterVMConstants.PROP_IS_READONCE, - IRegisterVMConstants.PROP_IS_WRITEABLE, IRegisterVMConstants.PROP_IS_WRITEONCE + IRegisterVMConstants.PROP_IS_FLOAT, + IRegisterVMConstants.PROP_IS_READABLE, + IRegisterVMConstants.PROP_IS_READONCE, + IRegisterVMConstants.PROP_IS_WRITEABLE, + IRegisterVMConstants.PROP_IS_WRITEONCE }) { @Override public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map properties) { - int type = 0; - if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_FLOAT)) ) { - type = 1; - } - - int readAttr = 0; - if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READABLE)) ) { - readAttr = 1; - } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_READONCE)) ) { - readAttr = 2; - } - - int writeAttr = 0; - if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEABLE)) ) { - writeAttr = 1; - } else if ( Boolean.TRUE.equals(properties.get(IRegisterVMConstants.PROP_IS_WRITEONCE)) ) { - writeAttr = 2; - } - - Object[] messageAttrs = new Object[] { type, readAttr, writeAttr }; + Object[] messageAttrs = constructTypeObjects( properties ); try { - update.setLabel(getMessageFormat().format( - messageAttrs, new StringBuffer(), null).toString(), columnIndex); + update.setLabel(getMessageFormat().format(messageAttrs, new StringBuffer(), null).toString(), columnIndex); } catch (IllegalArgumentException e) { update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, 0, "Failed formatting a message for column " + columnIndex + ", for update " + update, e)); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -312,7 +327,54 @@ public class RegisterVMNode extends AbstractExpressionVMNode new LabelColumnInfo(new LabelAttribute[] { new FormattedValueLabelText( MessagesForRegisterVM.RegisterVMNode_No_columns__text_format, - new String[] { PROP_NAME, IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE }), + new String[] { PROP_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE}) + { + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_REGISTER_SHOW_TYPE_NAMES); + return + showTypeNames != null && + !showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, + new FormattedValueLabelText( + MessagesForRegisterVM.RegisterVMNode_No_columns__text_format_with_type, + new String[] { PROP_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, + IRegisterVMConstants.PROP_IS_FLOAT, + IRegisterVMConstants.PROP_IS_READABLE, + IRegisterVMConstants.PROP_IS_READONCE, + IRegisterVMConstants.PROP_IS_WRITEABLE, + IRegisterVMConstants.PROP_IS_WRITEONCE, + PROP_REGISTER_SHOW_TYPE_NAMES}) + { + @Override + public void updateAttribute(ILabelUpdate update, int columnIndex, IStatus status, Map properties) { + Object[] messageAttrs = constructTypeObjects( properties ); + Object[] combinedAttrs = new Object[ messageAttrs.length + 2 ]; + combinedAttrs[0] = super.getPropertyValue(PROP_NAME, status, properties); + combinedAttrs[1] = super.getPropertyValue(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, status, properties); + for ( int idx = 0 ; idx < messageAttrs.length; idx ++ ) { + combinedAttrs[ idx + 2 ] = messageAttrs[ idx ]; + } + try { + update.setLabel(getMessageFormat().format(combinedAttrs, new StringBuffer(), null).toString(), columnIndex); + } catch (IllegalArgumentException e) { + update.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, 0, "Failed formatting a message for column " + columnIndex + ", for update " + update, e)); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_REGISTER_SHOW_TYPE_NAMES); + return + showTypeNames != null && + showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, new ErrorLabelText( MessagesForRegisterVM.RegisterVMNode_No_columns__Error__text_format, new String[] { PROP_NAME }), @@ -385,7 +447,94 @@ public class RegisterVMNode extends AbstractExpressionVMNode } } } - + + // + // We encapsulate the determination of the state of the "Show Type Names" ICON + // selection to this routine. This attribute information is not readily available + // from standard Interface definitions. So we use reflection to get the info. But + // in the future this will change and then we can just change this routine. This + // really should just be as simple as the code below, which could be done inline + // once it comes to pass. + // + // Boolean attribute = (Boolean) context.getProperty(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES); + // if (attribute != null) { + // return attribute; + // } + // return Boolean.FALSE; + // + // @param return-value Boolean.TRUE --> Show Types ICON is selected/depressed + // @param return-value Boolean.FALSE --> Show Types ICON is not selected/depressed + // + + @SuppressWarnings("unchecked") + private Boolean getShowTypeNamesState( IPresentationContext context ) { + // This is fairly ugly stuff. It should be the case that the "getPropery()" + // method of the presentation context should contain this attribute, but it + // does not. So we have to go mining for it. As it turns out the presentation + // context is actually an implementation class DebugModelPresentationContext + // from which you can get the IDebugModelPresentation instance. In turn this + // is a DelegatingModelPresentation instance which allows you to obtain the + // current set of internal attributes, which contains the current state of + // "Show Type Names" ICON selection. + Class contextClass = context.getClass(); + Method contextMethod = null; + try { + // Will return the instance of the class "DebugModelPresentationContext" + // if this is indeed the implementation we are expecting. + contextMethod = contextClass.getMethod( "getModelPresentation" , new Class[] {} ); //$NON-NLS-1$ + } + catch ( Exception ex ) {} + + IDebugModelPresentation debugModelPresentation = null ; + if (contextMethod != null) { + try { + // We invoke the "getModelPresntation" method to get the actual instance + // of the "DelegatingModelPresentation". + debugModelPresentation = (IDebugModelPresentation) contextMethod.invoke(context , new Object[0]); + } + catch ( Exception e ) {} + } + + if (debugModelPresentation != null) { + Class presentationClass = debugModelPresentation.getClass(); + Method presentationMethod = null; + try { + // The "getAttributeMethod" is a public method which returns the internal + // attributes. These should be part of the Interface but they are not. So + // we get them through this available method. + presentationMethod = presentationClass.getMethod( "getAttributeMap" , new Class[] {} ); //$NON-NLS-1$ + } + catch ( Exception ex ) {} + + HashMap attributeMap = null; + if (presentationMethod != null) { + try { + // Now get the actual HashMap attribute list so we can see if there is + // state information about the "Show Type Names" ICON. + attributeMap = (HashMap) presentationMethod.invoke(debugModelPresentation , new Object[0]); + } + catch ( Exception e ) {} + } + + if (attributeMap != null) { + // This attribute ( which is globally defined ) reflect the state of the ICON. + // If is exists is contains the current state. Non-existence would mean that + // the ICON has never been selected or changed. This is so at the very start + // when the view is first brought up. + Boolean attribute = (Boolean) attributeMap.get(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES); + + if (attribute != null) { + return attribute; + } + } + } + + // Could not get to the one of the methods needs to determine the state of the + // ICON or we could not get the attribute. Assume we are not showing the TYPE + // NAMES. + return Boolean.FALSE; + } + /** * @since 2.0 */ @@ -420,6 +569,11 @@ public class RegisterVMNode extends AbstractExpressionVMNode continue; } + // Capture the current "Show Type Names" ICON state in case there are no columns. + if (update.getProperties().contains(PROP_REGISTER_SHOW_TYPE_NAMES)) { + update.setProperty(PROP_REGISTER_SHOW_TYPE_NAMES, getShowTypeNamesState(update.getPresentationContext())); + } + service.getRegisterData( dmc, // Use the ViewerDataRequestMonitor in order to propagate the update's cancel request. Use an immediate diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/messages.properties b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/messages.properties index 674e86a8199..1b3f47e4e03 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/messages.properties +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/messages.properties @@ -23,28 +23,35 @@ RegisterGroupVMNode_No_columns__text_format={0} - {1} # {1} - error message RegisterGroupVMNode_No_columns__Error__text_format={0} - Error:{1} - RegisterVMNode_Name_column__text_format={0} RegisterVMNode_Description_column__text_format={0} -# {0} floating point, 0=integer/1=float -# {1} readability, 0=not readable/1=readable/2=readonce -# {2} write-ability, 0=not write-able/1=write-able/2=write once +# {0} - floating point, 0=integer/1=float +# {1} - readability, 0=not readable/1=readable/2=readonce +# {2} - write-ability, 0=not write-able/1=write-able/2=write once RegisterVMNode_Type_column__text_format={0,choice,0#Unsigned|1#Floating Point} / {1,choice,0#ReadNone|1#Readable|2#ReadOnce},{2,choice,0#WriteNone|1#Writeable|2#WriteOnce} RegisterVMNode_Expression_column__text_format={0} # {0} - register name -# {1} - value formatted in the active format. If the preferred format was -# available, then this is just the value. Otherwise, it's the string formatted -# by the FormattedValueLabelText. +# {1} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# FormattedValueLabelText and the complexly created type. RegisterVMNode_No_columns__text_format={0} = {1} +# {0} - register name +# {1} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# FormattedValueLabelText and the complexly created type. +# {2} - floating point, 0=integer/1=float +# {3} - readability, 0=not readable/1=readable/2=readonce +# {4} - write-ability, 0=not write-able/1=write-able/2=write once +RegisterVMNode_No_columns__text_format_with_type={0} = {1} (type: {2,choice,0#Unsigned|1#Floating Point} / {3,choice,0#ReadNone|1#Readable|2#ReadOnce},{4,choice,0#WriteNone|1#Writeable|2#WriteOnce}) + # {0} - register name # {1} - error message RegisterVMNode_No_columns__Error__text_format={0} - Error:{1} - RegisterBitFieldVMNode_Name_column__text_format={0} RegisterBitFieldVMNode_Description_column__text_format={0} @@ -53,9 +60,9 @@ RegisterBitFieldVMNode_Description_column__text_format={0} RegisterBitFieldVMNode_Type_column__text_format={0,choice,0#ReadNone|1#Readable|2#ReadOnce},{1,choice,0#WriteNone|1#Writeable|2#WriteOnce} # Message format for the value column text -# {0} - value formatted in the active format. If the preferred format was -# available, then this is just the value. Otherwise, it's the string formatted -# by FormattedValueLabelText. +# {0} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# FormattedValueLabelText. # {1} - bit field mnemonic RegisterBitFieldVMNode_Value_column__With_mnemonic__text_format={0} - {1} @@ -67,9 +74,23 @@ RegisterBitFieldVMNode_No_columns__text_format={0} = {1} # {0} - bit field name # {1} - error message +# {2} - readability, 0=not readable/1=readable/2=readonce +# {3} - write-ability, 0=not write-able/1=write-able/2=write once +RegisterBitFieldVMNode_No_columns__text_format_with_type={0} = {1} (type: {2,choice,0#ReadNone|1#Readable|2#ReadOnce},{3,choice,0#WriteNone|1#Writeable|2#WriteOnce}) + + +# {0} - bit field name +# {1} - bit field value # {2} - bit field mnemonic RegisterBitFieldVMNode_No_columns__With_mnemonic__text_format={0} = {1} - {2} +# {0} - bit field name +# {1} - bit field value +# {2} - bit field mnemonic +# {3} - readability, 0=not readable/1=readable/2=readonce +# {4} - write-ability, 0=not write-able/1=write-able/2=write once +RegisterBitFieldVMNode_No_columns__With_mnemonic__text_format_with_type={0} = {1} - {2} (type: {3,choice,0#ReadNone|1#Readable|2#ReadOnce},{4,choice,0#WriteNone|1#Writeable|2#WriteOnce}) + # {0} - bit field name # {1} - error message RegisterBitFieldVMNode_No_columns__Error__text_format={0} - Error:{1} diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java index d9390a88d48..14442ecf7b1 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/MessagesForVariablesVM.java @@ -31,6 +31,8 @@ public class MessagesForVariablesVM extends NLS { public static String VariableVMNode_Name_column__text_format; public static String VariableVMNode_NoColumns_column__Error__text_format; public static String VariableVMNode_NoColumns_column__text_format; + public static String VariableVMNode_NoColumns_column__No_string__text_format_with_type; + public static String VariableVMNode_NoColumns_column__text_format_with_type; public static String VariableVMNode_NoColumns_column__No_string__text_format; public static String VariableVMNode_Type_column__Error__text_format; public static String VariableVMNode_Type_column__text_format; diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java index 4cb26709365..b35675b3493 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java @@ -11,8 +11,10 @@ package org.eclipse.cdt.dsf.debug.ui.viewmodel.variable; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.RejectedExecutionException; @@ -83,6 +85,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.jface.util.PropertyChangeEvent; @@ -94,8 +97,9 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IMemento; +@SuppressWarnings("restriction") public class VariableVMNode extends AbstractExpressionVMNode - implements IElementEditor, IElementLabelProvider, IElementPropertiesProvider, IElementMementoProvider + implements IElementEditor, IElementLabelProvider, IElementPropertiesProvider, IElementMementoProvider { /** * @since 2.0 @@ -112,6 +116,11 @@ public class VariableVMNode extends AbstractExpressionVMNode */ private static final String PROP_VARIABLE_ADDRESS = "variable_address"; //$NON-NLS-1$ + /** + * @since 2.0 + */ + private static final String PROP_VARIABLE_SHOW_TYPE_NAMES = "variable_show_type_names"; //$NON-NLS-1$ + /** * @since 2.0 */ @@ -407,21 +416,23 @@ public class VariableVMNode extends AbstractExpressionVMNode FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT), IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS, IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT, - IDebugVMConstants.PROP_FORMATTED_VALUE_FORMAT_PREFERENCE}) + IDebugVMConstants.PROP_FORMATTED_VALUE_FORMAT_PREFERENCE, + PROP_VARIABLE_SHOW_TYPE_NAMES}) { - @Override + @Override public boolean isEnabled(IStatus status, Map properties) { - String[] formatIds = - (String[])properties.get(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS); - String activeFormat = (String)properties.get(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT); + Boolean showTypeNames = (Boolean) properties.get(PROP_VARIABLE_SHOW_TYPE_NAMES); + String[] formatIds = (String[]) properties.get(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS); + String activeFormat = (String) properties.get(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT); return - !IFormattedValues.STRING_FORMAT.equals(activeFormat) && + showTypeNames != null && + !showTypeNames.booleanValue() && + !IFormattedValues.STRING_FORMAT.equals(activeFormat) && formatIds != null && Arrays.asList(formatIds).contains(IFormattedValues.STRING_FORMAT) && super.isEnabled(status, properties); } }, - new FormattedValueLabelText( MessagesForVariablesVM.VariableVMNode_NoColumns_column__No_string__text_format, new String[] { @@ -429,7 +440,64 @@ public class VariableVMNode extends AbstractExpressionVMNode IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS, IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT, - IDebugVMConstants.PROP_FORMATTED_VALUE_FORMAT_PREFERENCE}), + IDebugVMConstants.PROP_FORMATTED_VALUE_FORMAT_PREFERENCE, + PROP_VARIABLE_SHOW_TYPE_NAMES}) + { + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_VARIABLE_SHOW_TYPE_NAMES); + return + showTypeNames != null && + !showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, + new FormattedValueLabelText( + MessagesForVariablesVM.VariableVMNode_NoColumns_column__text_format_with_type, + new String[] { + PROP_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, + FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT), + PROP_VARIABLE_TYPE_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT, + IDebugVMConstants.PROP_FORMATTED_VALUE_FORMAT_PREFERENCE, + PROP_VARIABLE_SHOW_TYPE_NAMES}) + { + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_VARIABLE_SHOW_TYPE_NAMES); + String[] formatIds = (String[]) properties.get(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS); + String activeFormat = (String) properties.get(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT); + return + showTypeNames != null && + showTypeNames.booleanValue() && + !IFormattedValues.STRING_FORMAT.equals(activeFormat) && + formatIds != null && + Arrays.asList(formatIds).contains(IFormattedValues.STRING_FORMAT) && + super.isEnabled(status, properties); + } + }, + new FormattedValueLabelText( + MessagesForVariablesVM.VariableVMNode_NoColumns_column__No_string__text_format_with_type, + new String[] { + PROP_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, + PROP_VARIABLE_TYPE_NAME, + IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS, + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT, + IDebugVMConstants.PROP_FORMATTED_VALUE_FORMAT_PREFERENCE, + PROP_VARIABLE_SHOW_TYPE_NAMES}) + { + @Override + public boolean isEnabled(IStatus status, Map properties) { + Boolean showTypeNames = (Boolean) properties.get(PROP_VARIABLE_SHOW_TYPE_NAMES); + return + showTypeNames != null && + showTypeNames.booleanValue() && + super.isEnabled(status, properties); + } + }, new ErrorLabelText( MessagesForVariablesVM.VariableVMNode_NoColumns_column__Error__text_format, new String[] { PROP_NAME }), @@ -504,6 +572,93 @@ public class VariableVMNode extends AbstractExpressionVMNode } } + // + // We encapsulate the determination of the state of the "Show Type Names" ICON + // selection to this routine. This attribute information is not readily available + // from standard Interface definitions. So we use reflection to get the info. But + // in the future this will change and then we can just change this routine. This + // really should just be as simple as the code below, which could be done inline + // once it comes to pass. + // + // Boolean attribute = (Boolean) context.getProperty(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES); + // if (attribute != null) { + // return attribute; + // } + // return Boolean.FALSE; + // + // @param return-value Boolean.TRUE --> Show Types ICON is selected/depressed + // @param return-value Boolean.FALSE --> Show Types ICON is not selected/depressed + // + + @SuppressWarnings("unchecked") + private Boolean getShowTypeNamesState( IPresentationContext context ) { + // This is fairly ugly stuff. It should be the case that the "getPropery()" + // method of the presentation context should contain this attribute, but it + // does not. So we have to go mining for it. As it turns out the presentation + // context is actually an implementation class DebugModelPresentationContext + // from which you can get the IDebugModelPresentation instance. In turn this + // is a DelegatingModelPresentation instance which allows you to obtain the + // current set of internal attributes, which contains the current state of + // "Show Type Names" ICON selection. + Class contextClass = context.getClass(); + Method contextMethod = null; + try { + // Will return the instance of the class "DebugModelPresentationContext" + // if this is indeed the implementation we are expecting. + contextMethod = contextClass.getMethod( "getModelPresentation" , new Class[] {} ); //$NON-NLS-1$ + } + catch ( Exception ex ) {} + + IDebugModelPresentation debugModelPresentation = null ; + if (contextMethod != null) { + try { + // We invoke the "getModelPresntation" method to get the actual instance + // of the "DelegatingModelPresentation". + debugModelPresentation = (IDebugModelPresentation) contextMethod.invoke(context , new Object[0]); + } + catch ( Exception e ) {} + } + + if (debugModelPresentation != null) { + Class presentationClass = debugModelPresentation.getClass(); + Method presentationMethod = null; + try { + // The "getAttributeMethod" is a public method which returns the internal + // attributes. These should be part of the Interface but they are not. So + // we get them through this available method. + presentationMethod = presentationClass.getMethod( "getAttributeMap" , new Class[] {} ); //$NON-NLS-1$ + } + catch ( Exception ex ) {} + + HashMap attributeMap = null; + if (presentationMethod != null) { + try { + // Now get the actual HashMap attribute list so we can see if there is + // state information about the "Show Type Names" ICON. + attributeMap = (HashMap) presentationMethod.invoke(debugModelPresentation , new Object[0]); + } + catch ( Exception e ) {} + } + + if (attributeMap != null) { + // This attribute ( which is globally defined ) reflect the state of the ICON. + // If is exists is contains the current state. Non-existence would mean that + // the ICON has never been selected or changed. This is so at the very start + // when the view is first brought up. + Boolean attribute = (Boolean) attributeMap.get(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES); + + if (attribute != null) { + return attribute; + } + } + } + + // Could not get to the one of the methods needs to determine the state of the + // ICON or we could not get the attribute. Assume we are not showing the TYPE + // NAMES. + return Boolean.FALSE; + } + /** * @since 2.0 */ @@ -529,7 +684,12 @@ public class VariableVMNode extends AbstractExpressionVMNode for (final IPropertiesUpdate update : updates) { IExpression expression = (IExpression)DebugPlugin.getAdapter(update.getElement(), IExpression.class); if (expression != null) { - update.setProperty(AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION, expression.getExpressionText()); + update.setProperty(AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION, expression.getExpressionText()); + } + + // Capture the current "Show Type Names" ICON state in case there are no columns. + if (update.getProperties().contains(PROP_VARIABLE_SHOW_TYPE_NAMES)) { + update.setProperty(PROP_VARIABLE_SHOW_TYPE_NAMES, getShowTypeNamesState(update.getPresentationContext())); } IExpressionDMContext dmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IExpressions.IExpressionDMContext.class); @@ -603,11 +763,11 @@ public class VariableVMNode extends AbstractExpressionVMNode update.setProperty(PROP_VARIABLE_BASIC_TYPE, type.name()); } - /* - * If this node has an expression then it has already been filled in by the higher - * level logic. If not then we need to supply something. In the previous version - * ( pre-property based ) we supplied the name. So we will do that here also. - */ + // + // If this node has an expression then it has already been filled in by the higher + // level logic. If not then we need to supply something. In the previous version + // ( pre-property based ) we supplied the name. So we will do that here also. + // IExpression expression = (IExpression)DebugPlugin.getAdapter(update.getElement(), IExpression.class); if (expression == null) { update.setProperty(AbstractExpressionVMNode.PROP_ELEMENT_EXPRESSION, data.getName()); @@ -864,8 +1024,6 @@ public class VariableVMNode extends AbstractExpressionVMNode stackFrameService.getLocals(frameDmc, rm); } - //private final static int MAX_STRING_VALUE_LENGTH = 40; - public int getDeltaFlags(Object e) { if ( e instanceof ISuspendedDMEvent || e instanceof IMemoryChangedEvent || diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties index a9147b2a583..c957a6e9dec 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/messages.properties @@ -24,23 +24,38 @@ VariableVMNode_Type_column__Error__text_format= VariableVMNode_Type_column__text_format={0} # Message format for the value column text -# {0} - value formatted in the active format. If the preferred format was -# available, then this is just the value. Otherwise, it's the string formatted -# by the format in VariableVMNode_Value_column__Value__text_format. +# {0} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# format in VariableVMNode_Value_column__Value__text_format. # {1} - value in STRING format. VariableVMNode_Value_column__text_format={0} {1} # {0} - variable name -# {1} - value formatted in the active format. If the preferred format was -# available, then this is just the value. Otherwise, it's the string formatted -# by the format in VariableVMNode_Value_column__Value__text_format. +# {1} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# format in VariableVMNode_Value_column__Value__text_format. # {2} - value in STRING format. VariableVMNode_NoColumns_column__text_format={0} = {1} {2} # {0} - variable name -# {1} - value formatted in the active format. If the preferred format was -# available, then this is just the value. Otherwise, it's the string formatted -# by the format in VariableVMNode_Value_column__Value__text_format. +# {1} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# format in VariableVMNode_Value_column__Value__text_format. +# {2} - type of the variable being displayed +VariableVMNode_NoColumns_column__No_string__text_format_with_type={0} = {1} (type: {2}) + +# {0} - variable name +# {1} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# format in VariableVMNode_Value_column__Value__text_format. +# {2} - value in STRING format. +# {3} - type of the variable being displayed +VariableVMNode_NoColumns_column__text_format_with_type={0} = {1} {2} (type: {3}) + +# {0} - variable name +# {1} - value formatted in the active format. If the preferred format was available, +# then this is just the value. Otherwise, it's the string formatted by the +# format in VariableVMNode_Value_column__Value__text_format. VariableVMNode_NoColumns_column__No_string__text_format={0} = {1} # {0} - variable name