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

Bugzilla 204992 & 205735

This commit is contained in:
Randy Rohrbach 2008-04-29 17:24:20 +00:00
parent 589c9a1294
commit c067bd385f
4 changed files with 143 additions and 11 deletions

View file

@ -47,13 +47,18 @@ import org.eclipse.dd.dsf.ui.viewmodel.VMDelta;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.debug.core.model.IExpression; import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; 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.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor; import org.eclipse.jface.viewers.ComboBoxCellEditor;
@ -216,7 +221,7 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
/* /*
* Format has been validated. Get the formatted value. * Format has been validated. Get the formatted value.
*/ */
FormattedValueDMContext valueDmc = regService.getFormattedValueContext(dmc, finalFormatId); final FormattedValueDMContext valueDmc = regService.getFormattedValueContext(dmc, finalFormatId);
getDMVMProvider().getModelData( getDMVMProvider().getModelData(
RegisterBitFieldVMNode.this, update, regService, valueDmc, RegisterBitFieldVMNode.this, update, regService, valueDmc,
@ -224,7 +229,13 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
@Override @Override
public void handleCompleted() { public void handleCompleted() {
if (!isSuccess()) { if (!isSuccess()) {
handleFailedUpdate(update); if (getStatus().getCode() == IDsfStatusConstants.INVALID_STATE) {
update.setLabel("...", labelIndex); //$NON-NLS-1$
} else {
update.setLabel("Error: " + getStatus().getMessage(), labelIndex); //$NON-NLS-1$
}
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
update.done();
return; return;
} }
@ -239,6 +250,17 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
else { else {
update.setLabel(getData().getFormattedValue() , labelIndex); update.setLabel(getData().getFormattedValue() , labelIndex);
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
// color based on change history
FormattedValueDMData oldData = (FormattedValueDMData) getDMVMProvider().getArchivedModelData(
RegisterBitFieldVMNode.this, update, valueDmc);
if(oldData != null && !oldData.getFormattedValue().equals(getData().getFormattedValue())) {
update.setBackground(
DebugUIPlugin.getPreferenceColor(IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB(), labelIndex);
}
update.done(); update.done();
} }
}, },
@ -288,7 +310,50 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
assert getStatus().isOK() || assert getStatus().isOK() ||
getStatus().getCode() != IDsfStatusConstants.INTERNAL_ERROR || getStatus().getCode() != IDsfStatusConstants.INTERNAL_ERROR ||
getStatus().getCode() != IDsfStatusConstants.NOT_SUPPORTED; getStatus().getCode() != IDsfStatusConstants.NOT_SUPPORTED;
handleFailedUpdate(update); /*
* Instead of just failing this outright we are going to attempt to do more here.
* Failing it outright causes the view to display ... for all columns in the line
* and this is uninformative about what is happening. We may be trying to show a
* register whos retrieval has been cancelled by the lower level. Perhaps because
* we are stepping extremely fast and state changes cause the register service to
* return these requests without ever sending them to the debug engine.
*
*/
String[] localColumns = update.getPresentationContext().getColumns();
if (localColumns == null)
localColumns = new String[] { IDebugVMConstants.COLUMN_ID__NAME };
for (int idx = 0; idx < localColumns.length; idx++) {
if (IDebugVMConstants.COLUMN_ID__NAME.equals(localColumns[idx])) {
/*
* This used to be easy in that the DMC contained the name. Which allowed us
* to display the register name and an error message across from it. Now that
* name must come from the data and we could not retrieve the data we do not
* have anything intelligent to show here. I think this is going to look very
* ugly and will need to be worked on. We know the service has the name with
* it, it is just the dynamic part which cannot be obtained ( as explained in
* comments above ).
*/
update.setLabel("Unknown name", idx); //$NON-NLS-1$
update.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER), idx);
} else if (IDebugVMConstants.COLUMN_ID__TYPE.equals(localColumns[idx])) {
update.setLabel("", idx); //$NON-NLS-1$
} else if (IDebugVMConstants.COLUMN_ID__VALUE.equals(localColumns[idx])) {
if (getStatus().getCode() == IDsfStatusConstants.INVALID_STATE) {
update.setLabel("...", idx); //$NON-NLS-1$
} else {
update.setLabel("Error: " + getStatus().getMessage(), idx); //$NON-NLS-1$
}
} else if (IDebugVMConstants.COLUMN_ID__DESCRIPTION.equals(localColumns[idx])) {
update.setLabel("...", idx); //$NON-NLS-1$
} else if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(localColumns[idx])) {
update.setLabel("", idx); //$NON-NLS-1$
}
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
}
update.done();
return; return;
} }
@ -336,6 +401,8 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
update.setLabel(getData().getName(), idx); update.setLabel(getData().getName(), idx);
} }
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
} }
if ( ! weAreExtractingFormattedData ) { if ( ! weAreExtractingFormattedData ) {
@ -345,6 +412,7 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
if (IDebugVMConstants.COLUMN_ID__VALUE.equals(localColumns[idx])) { if (IDebugVMConstants.COLUMN_ID__VALUE.equals(localColumns[idx])) {
updateFormattedRegisterValue(update, idx, dmc, getData() ); updateFormattedRegisterValue(update, idx, dmc, getData() );
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
} }
} }
} }

View file

@ -38,6 +38,7 @@ import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.debug.core.model.IExpression; import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.internal.ui.DebugPluginImages; import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
@ -46,6 +47,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.IPresentationContext;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.TextCellEditor;
@ -215,6 +217,8 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
protected void fillColumnLabel(IRegisterGroupDMContext dmContext, IRegisterGroupDMData dmData, protected void fillColumnLabel(IRegisterGroupDMContext dmContext, IRegisterGroupDMData dmData,
String columnId, int idx, ILabelUpdate update) String columnId, int idx, ILabelUpdate update)
{ {
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
if (IDebugVMConstants.COLUMN_ID__NAME.equals(columnId)) { if (IDebugVMConstants.COLUMN_ID__NAME.equals(columnId)) {
update.setLabel(dmData.getName(), idx); update.setLabel(dmData.getName(), idx);
update.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP), idx); update.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER_GROUP), idx);

View file

@ -53,6 +53,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.IPresentationContext;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.ICellModifier;
@ -226,7 +227,13 @@ public class RegisterVMNode extends AbstractExpressionVMNode
@Override @Override
public void handleCompleted() { public void handleCompleted() {
if (!isSuccess()) { if (!isSuccess()) {
handleFailedUpdate(update); if (getStatus().getCode() == IDsfStatusConstants.INVALID_STATE) {
update.setLabel("...", labelIndex); //$NON-NLS-1$
} else {
update.setLabel("Error: " + getStatus().getMessage(), labelIndex); //$NON-NLS-1$
}
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
update.done();
return; return;
} }
/* /*
@ -240,10 +247,9 @@ public class RegisterVMNode extends AbstractExpressionVMNode
RegisterVMNode.this, update, valueDmc); RegisterVMNode.this, update, valueDmc);
if(oldData != null && !oldData.getFormattedValue().equals(getData().getFormattedValue())) { if(oldData != null && !oldData.getFormattedValue().equals(getData().getFormattedValue())) {
update.setBackground( update.setBackground(
DebugUIPlugin.getPreferenceColor( DebugUIPlugin.getPreferenceColor(IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB(), labelIndex);
IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB(),
labelIndex);
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
update.done(); update.done();
} }
}, },
@ -291,7 +297,50 @@ public class RegisterVMNode extends AbstractExpressionVMNode
assert getStatus().isOK() || assert getStatus().isOK() ||
getStatus().getCode() != IDsfStatusConstants.INTERNAL_ERROR || getStatus().getCode() != IDsfStatusConstants.INTERNAL_ERROR ||
getStatus().getCode() != IDsfStatusConstants.NOT_SUPPORTED; getStatus().getCode() != IDsfStatusConstants.NOT_SUPPORTED;
handleFailedUpdate(update); /*
* Instead of just failing this outright we are going to attempt to do more here.
* Failing it outright causes the view to display ... for all columns in the line
* and this is uninformative about what is happening. We may be trying to show a
* register whos retrieval has been cancelled by the lower level. Perhaps because
* we are stepping extremely fast and state changes cause the register service to
* return these requests without ever sending them to the debug engine.
*
*/
String[] localColumns = update.getPresentationContext().getColumns();
if (localColumns == null)
localColumns = new String[] { IDebugVMConstants.COLUMN_ID__NAME };
for (int idx = 0; idx < localColumns.length; idx++) {
if (IDebugVMConstants.COLUMN_ID__NAME.equals(localColumns[idx])) {
/*
* This used to be easy in that the DMC contained the name. Which allowed us
* to display the register name and an error message across from it. Now that
* name must come from the data and we could not retrieve the data we do not
* have anything intelligent to show here. I think this is going to look very
* ugly and will need to be worked on. We know the service has the name with
* it, it is just the dynamic part which cannot be obtained ( as explained in
* comments above ).
*/
update.setLabel("Unknown name", idx); //$NON-NLS-1$
update.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER), idx);
} else if (IDebugVMConstants.COLUMN_ID__TYPE.equals(localColumns[idx])) {
update.setLabel("", idx); //$NON-NLS-1$
} else if (IDebugVMConstants.COLUMN_ID__VALUE.equals(localColumns[idx])) {
if (getStatus().getCode() == IDsfStatusConstants.INVALID_STATE) {
update.setLabel("...", idx); //$NON-NLS-1$
} else {
update.setLabel("Error: " + getStatus().getMessage(), idx); //$NON-NLS-1$
}
} else if (IDebugVMConstants.COLUMN_ID__DESCRIPTION.equals(localColumns[idx])) {
update.setLabel("...", idx); //$NON-NLS-1$
} else if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(localColumns[idx])) {
update.setLabel("", idx); //$NON-NLS-1$
}
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
}
update.done();
return; return;
} }
@ -310,6 +359,7 @@ public class RegisterVMNode extends AbstractExpressionVMNode
boolean weAreExtractingFormattedData = false; boolean weAreExtractingFormattedData = false;
for (int idx = 0; idx < localColumns.length; idx++) { for (int idx = 0; idx < localColumns.length; idx++) {
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
if (IDebugVMConstants.COLUMN_ID__NAME.equals(localColumns[idx])) { if (IDebugVMConstants.COLUMN_ID__NAME.equals(localColumns[idx])) {
update.setLabel(getData().getName(), idx); update.setLabel(getData().getName(), idx);
update.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER), idx); update.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_REGISTER), idx);

View file

@ -58,6 +58,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.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2; import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.ICellModifier;
@ -254,8 +255,10 @@ public class VariableVMNode extends AbstractExpressionVMNode
} else if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(localColumns[idx])) { } else if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(localColumns[idx])) {
update.setLabel(dmc.getExpression(), idx); update.setLabel(dmc.getExpression(), idx);
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
} }
update.done(); update.done();
return; return;
} }
@ -290,6 +293,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
update.setLabel(getData().getName(), idx); update.setLabel(getData().getName(), idx);
} }
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
} }
if ( ! weAreExtractingFormattedData ) { if ( ! weAreExtractingFormattedData ) {
@ -299,6 +303,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
if (IDebugVMConstants.COLUMN_ID__VALUE.equals(localColumns[idx])) { if (IDebugVMConstants.COLUMN_ID__VALUE.equals(localColumns[idx])) {
updateFormattedExpressionValue(update, idx, dmc, getData()); updateFormattedExpressionValue(update, idx, dmc, getData());
} }
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], idx);
} }
} }
} }
@ -331,7 +336,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
@Override @Override
public void handleCompleted() { public void handleCompleted() {
if (!isSuccess()) { if (!isSuccess()) {
handleFailedUpdate(update); update.setLabel("Format information not available", labelIndex);
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
update.done();
return; return;
} }
@ -381,7 +388,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
@Override @Override
public void handleCompleted() { public void handleCompleted() {
if (!isSuccess()) { if (!isSuccess()) {
handleFailedUpdate(update); update.setLabel("Error : " + getStatus().getMessage(), labelIndex);
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
update.done();
return; return;
} }
@ -396,6 +405,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
} }
update.setLabel(stringValueBuf.toString(), labelIndex);*/ update.setLabel(stringValueBuf.toString(), labelIndex);*/
update.setLabel(getData().getFormattedValue(), labelIndex); update.setLabel(getData().getFormattedValue(), labelIndex);
update.setFontData(JFaceResources.getFontDescriptor(IInternalDebugUIConstants.VARIABLE_TEXT_FONT).getFontData()[0], labelIndex);
// Color based on change history // Color based on change history
FormattedValueDMData oldData = (FormattedValueDMData) getDMVMProvider().getArchivedModelData( FormattedValueDMData oldData = (FormattedValueDMData) getDMVMProvider().getArchivedModelData(