1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

Bug 305365 allowing editable value to differ from formatted value

This commit is contained in:
David Dubrow 2010-03-13 14:59:57 +00:00
parent 900aeefc47
commit e7d0761389
3 changed files with 23 additions and 7 deletions

View file

@ -374,11 +374,13 @@ public class SyncVariableDataAccess {
private IFormattedDataDMContext fDmc; private IFormattedDataDMContext fDmc;
private String fFormatId; private String fFormatId;
private boolean fEditable;
public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId) { public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId, boolean editable) {
super(); super();
fDmc = dmc; fDmc = dmc;
fFormatId = formatId; fFormatId = formatId;
fEditable = editable;
} }
@Override @Override
@ -413,10 +415,7 @@ public class SyncVariableDataAccess {
service.getFormattedExpressionValue(formDmc, new DataRequestMonitor<FormattedValueDMData>(session.getExecutor(), rm) { service.getFormattedExpressionValue(formDmc, new DataRequestMonitor<FormattedValueDMData>(session.getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
/* rm.setData(fEditable ? getData().getEditableValue() : getData().getFormattedValue());
* All good set return value.
*/
rm.setData(getData().getFormattedValue());
rm.done(); rm.done();
} }
}); });
@ -424,6 +423,14 @@ public class SyncVariableDataAccess {
} }
public String getFormattedValue(Object element, String formatId) { public String getFormattedValue(Object element, String formatId) {
return getValue(element, formatId, false);
}
public String getEditableValue(Object element, String formatId) {
return getValue(element, formatId, true);
}
public String getValue(Object element, String formatId, boolean editable) {
/* /*
* Get the DMC and the session. If element is not an register DMC, or * Get the DMC and the session. If element is not an register DMC, or
@ -439,7 +446,7 @@ public class SyncVariableDataAccess {
* guard against RejectedExecutionException, because * guard against RejectedExecutionException, because
* DsfSession.getSession() above would only return an active session. * DsfSession.getSession() above would only return an active session.
*/ */
GetFormattedValueValueQuery query = new GetFormattedValueValueQuery(dmc, formatId); GetFormattedValueValueQuery query = new GetFormattedValueValueQuery(dmc, formatId, editable);
session.getExecutor().execute(query); session.getExecutor().execute(query);
/* /*

View file

@ -90,7 +90,7 @@ public class VariableCellModifier extends WatchExpressionCellModifier {
formatId = IFormattedValues.NATURAL_FORMAT; formatId = IFormattedValues.NATURAL_FORMAT;
} }
String value = fDataAccess.getFormattedValue(element, formatId); String value = fDataAccess.getEditableValue(element, formatId);
if (value == null) { if (value == null) {
return "..."; //$NON-NLS-1$ return "..."; //$NON-NLS-1$

View file

@ -114,15 +114,24 @@ public interface IFormattedValues extends IDsfService {
public static class FormattedValueDMData implements IDMData { public static class FormattedValueDMData implements IDMData {
private final String fValue; private final String fValue;
private String fEditableValue;
public FormattedValueDMData(String value) { public FormattedValueDMData(String value) {
fValue = value; fValue = value;
fEditableValue = value;
} }
public String getFormattedValue() { public String getFormattedValue() {
return fValue; return fValue;
} }
public void setEditableValue(String editableValue) {
fEditableValue = editableValue;
}
public String getEditableValue() {
return fEditableValue;
}
} }
} }