From 775e47d5ccde5f712800db105cd58079ede28578 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Sun, 26 Oct 2008 03:14:56 +0000 Subject: [PATCH] Bugzilla 252107 --- .../ui/viewmodel/register/RegisterVMNode.java | 52 +++++++++++++++---- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMNode.java index d6b6a3b4d75..c45fb42bd60 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterVMNode.java @@ -16,12 +16,12 @@ import java.util.concurrent.RejectedExecutionException; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.dd.dsf.concurrent.CountingRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DsfExecutor; import org.eclipse.dd.dsf.concurrent.DsfRunnable; import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants; import org.eclipse.dd.dsf.concurrent.ImmediateExecutor; -import org.eclipse.dd.dsf.concurrent.MultiRequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMContext; @@ -217,9 +217,20 @@ public class RegisterVMNode extends AbstractExpressionVMNode for ( final QueuedValueUpdate up : updates ) { final ILabelUpdate update = up.getUpdate(); - final int idx = up.getIndex(); final FormattedValueDMContext valueDmc = up.getValueDmc(); + /* + * It is possible that we could not get a formatted DMC. In this case the setup + * logic puts a null as the value. So in this case we just complete this one + * with nothing. + */ + if ( valueDmc == null ) { + update.done(); + continue; + } + + final int idx = up.getIndex(); + getDMVMProvider().getModelData( RegisterVMNode.this, update, @@ -358,8 +369,8 @@ public class RegisterVMNode extends AbstractExpressionVMNode final ArrayList valueUpdatesToProcess = new ArrayList(); final DsfExecutor dsfExecutor = getSession().getExecutor(); - final MultiRequestMonitor mrm = - new MultiRequestMonitor(dsfExecutor, null) { + final CountingRequestMonitor crm = + new CountingRequestMonitor(dsfExecutor, null) { @Override public void handleCompleted() { if (!isSuccess()) { @@ -376,6 +387,9 @@ public class RegisterVMNode extends AbstractExpressionVMNode retrieveAllFormattedDataValues( valueUpdatesToProcess ); } }; + + crm.setDoneCount( calculateTheNumberOfRowsWithValueColumns(updates) ); + /* * Process each update request, creating a QUEUE of requests which need further processing * for the formatted values. @@ -485,18 +499,23 @@ public class RegisterVMNode extends AbstractExpressionVMNode valueUpdatesToProcess.add(valueUpdate); /* - * Fetch the associated formatted DMC for this field. This is added to the multi-request - * monitor so they can all be gathered and processed in a single set. + * Fetch the associated formatted DMC for this field. Note that every time we + * complete the request for a Formatted DMC we tell the Counting Request Monitor + * we have completed one in the list. */ DataRequestMonitor rm = new DataRequestMonitor(dsfExecutor, null) { @Override public void handleCompleted() { - valueUpdate.setValueDmc(getData()); - mrm.requestMonitorDone(this); + if ( getStatus().isOK() ) { + valueUpdate.setValueDmc(getData()); + } + else { + valueUpdate.setValueDmc(null); + } + crm.done(); } }; - mrm.add(rm); getFormattedDmcForReqister(update, dmc, rm); } else if (IDebugVMConstants.COLUMN_ID__TYPE.equals(localColumns[idx])) { IRegisterDMData data = getData(); @@ -536,6 +555,21 @@ public class RegisterVMNode extends AbstractExpressionVMNode } } + private int calculateTheNumberOfRowsWithValueColumns( ILabelUpdate updates[] ) { + int count = 0; + for (final ILabelUpdate update : updates) { + String[] columns = update.getColumnIds(); + if (columns == null) columns = new String[] { IDebugVMConstants.COLUMN_ID__NAME }; + + for (int idx = 0; idx < columns.length; idx++) { + if (IDebugVMConstants.COLUMN_ID__VALUE.equals(columns[idx])) { + count ++; + } + } + } + return count; + } + /* * (non-Javadoc) * @see org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMNode#update(org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate[])