1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[290607] Additional fix to avoid providing properties not requested.

This commit is contained in:
John Cortell 2009-09-28 20:23:46 +00:00
parent 46a66d6e5d
commit d324571112

View file

@ -266,16 +266,16 @@ public class FormattedValueVMUtil {
// PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, and the active format // PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, and the active format
// has not been explicitly requested, then we need an additional // has not been explicitly requested, then we need an additional
// iteration to provide it. // iteration to provide it.
boolean activeFormatRequested = false; // does the update object ask for PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE? boolean activeFormatValueRequested = false; // does the update object ask for PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE?
boolean activeFormatHandled = false; // have we come across a specific format request that is the active format? boolean activeFormatValueHandled = false; // have we come across a specific format request that is the active format?
for (Iterator<String> itr = update.getProperties().iterator(); itr.hasNext() || (activeFormatRequested && !activeFormatHandled);) { for (Iterator<String> itr = update.getProperties().iterator(); itr.hasNext() || (activeFormatValueRequested && !activeFormatValueHandled);) {
String nextFormat; String nextFormat;
if (itr.hasNext()) { if (itr.hasNext()) {
String propertyName = itr.next(); String propertyName = itr.next();
if (propertyName.startsWith(IDebugVMConstants.PROP_FORMATTED_VALUE_BASE)) { if (propertyName.startsWith(IDebugVMConstants.PROP_FORMATTED_VALUE_BASE)) {
nextFormat = FormattedValueVMUtil.getFormatFromProperty(propertyName); nextFormat = FormattedValueVMUtil.getFormatFromProperty(propertyName);
if (nextFormat.equals(activeFormat)) { if (nextFormat.equals(activeFormat)) {
activeFormatHandled = true; activeFormatValueHandled = true;
} }
// if we know the supported formats (we may not), then no-op if this format is unsupported // if we know the supported formats (we may not), then no-op if this format is unsupported
if (availableFormats != null && !isFormatAvailable(nextFormat, availableFormats)) { if (availableFormats != null && !isFormatAvailable(nextFormat, availableFormats)) {
@ -284,7 +284,7 @@ public class FormattedValueVMUtil {
} }
else if (propertyName.equals(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE)) { else if (propertyName.equals(IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE)) {
assert activeFormat != null : "Our caller should have provided the available formats if this property was specified; given available formats, an 'active' nomination is guaranteed."; //$NON-NLS-1$ assert activeFormat != null : "Our caller should have provided the available formats if this property was specified; given available formats, an 'active' nomination is guaranteed."; //$NON-NLS-1$
activeFormatRequested = true; activeFormatValueRequested = true;
continue; // we may end up making an additional run continue; // we may end up making an additional run
} }
else { else {
@ -293,9 +293,10 @@ public class FormattedValueVMUtil {
} else { } else {
// the additional iteration to handle the active format // the additional iteration to handle the active format
nextFormat = activeFormat; nextFormat = activeFormat;
activeFormatHandled = true; activeFormatValueHandled = true;
} }
final boolean _activeFormatValueRequested = activeFormatValueRequested;
final FormattedValueDMContext formattedValueDmc = service.getFormattedValueContext(dmc, nextFormat); final FormattedValueDMContext formattedValueDmc = service.getFormattedValueContext(dmc, nextFormat);
service.getFormattedExpressionValue( service.getFormattedExpressionValue(
formattedValueDmc, formattedValueDmc,
@ -309,7 +310,7 @@ public class FormattedValueVMUtil {
update.setProperty( update.setProperty(
FormattedValueVMUtil.getPropertyForFormatId(format), FormattedValueVMUtil.getPropertyForFormatId(format),
getData().getFormattedValue()); getData().getFormattedValue());
if (format.equals(activeFormat)) { if (_activeFormatValueRequested && format.equals(activeFormat)) {
update.setProperty( update.setProperty(
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE, IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
getData().getFormattedValue()); getData().getFormattedValue());