mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 305365 allowing editable value to differ from formatted value
This commit is contained in:
parent
900aeefc47
commit
e7d0761389
3 changed files with 23 additions and 7 deletions
|
@ -374,11 +374,13 @@ public class SyncVariableDataAccess {
|
|||
|
||||
private IFormattedDataDMContext fDmc;
|
||||
private String fFormatId;
|
||||
private boolean fEditable;
|
||||
|
||||
public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId) {
|
||||
public GetFormattedValueValueQuery(IFormattedDataDMContext dmc, String formatId, boolean editable) {
|
||||
super();
|
||||
fDmc = dmc;
|
||||
fFormatId = formatId;
|
||||
fEditable = editable;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -413,10 +415,7 @@ public class SyncVariableDataAccess {
|
|||
service.getFormattedExpressionValue(formDmc, new DataRequestMonitor<FormattedValueDMData>(session.getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
/*
|
||||
* All good set return value.
|
||||
*/
|
||||
rm.setData(getData().getFormattedValue());
|
||||
rm.setData(fEditable ? getData().getEditableValue() : getData().getFormattedValue());
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
|
@ -424,6 +423,14 @@ public class SyncVariableDataAccess {
|
|||
}
|
||||
|
||||
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
|
||||
|
@ -439,7 +446,7 @@ public class SyncVariableDataAccess {
|
|||
* guard against RejectedExecutionException, because
|
||||
* 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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -90,7 +90,7 @@ public class VariableCellModifier extends WatchExpressionCellModifier {
|
|||
formatId = IFormattedValues.NATURAL_FORMAT;
|
||||
}
|
||||
|
||||
String value = fDataAccess.getFormattedValue(element, formatId);
|
||||
String value = fDataAccess.getEditableValue(element, formatId);
|
||||
|
||||
if (value == null) {
|
||||
return "..."; //$NON-NLS-1$
|
||||
|
|
|
@ -114,15 +114,24 @@ public interface IFormattedValues extends IDsfService {
|
|||
public static class FormattedValueDMData implements IDMData {
|
||||
|
||||
private final String fValue;
|
||||
private String fEditableValue;
|
||||
|
||||
public FormattedValueDMData(String value) {
|
||||
fValue = value;
|
||||
fEditableValue = value;
|
||||
}
|
||||
|
||||
public String getFormattedValue() {
|
||||
return fValue;
|
||||
}
|
||||
|
||||
public void setEditableValue(String editableValue) {
|
||||
fEditableValue = editableValue;
|
||||
}
|
||||
|
||||
public String getEditableValue() {
|
||||
return fEditableValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue