diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
index bff2b7d7dbd..82b729d0a6d 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
@@ -16,29 +16,32 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
-import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractContainerVMNode;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.dsf.ui.concurrent.ViewerCountingRequestMonitor;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.ui.IMemento;
@@ -79,50 +82,56 @@ public class ContainerVMNode extends AbstractContainerVMNode
});
}
-
- @Override
- protected void updateLabelInSessionThread(final ILabelUpdate update) {
- IProcesses processService = getServicesTracker().getService(IProcesses.class);
- IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- if (processService == null || runControl == null) {
- handleFailedUpdate(update);
- return;
- }
-
- final IProcessDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IProcessDMContext.class);
- final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class);
-
- String imageKey = null;
- if (runControl.isSuspended(contDmc)) {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
- } else {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
- }
- update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
-
- processService.getExecutionData(
- procDmc,
- new ViewerDataRequestMonitor(getExecutor(), update) {
- @Override
- public void handleCompleted() {
- if (!isSuccess()) {
- update.setLabel("", 0); //$NON-NLS-1$
- update.done();
- return;
- }
-
- // Create Labels of type Name[PID] if the pid is available
- final StringBuilder builder = new StringBuilder();
- builder.append(getData().getName());
- if (getData().getId() != null && getData().getId().length() > 0) {
- builder.append("[" + getData().getId()+ "]"); //$NON-NLS-1$//$NON-NLS-2$
- }
- update.setLabel(builder.toString(), 0);
- update.done();
- }
- });
- }
+ @Override
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
+
+ for (int i = 0; i < updates.length; i++) {
+ final IPropertiesUpdate update = updates[i];
+
+ final ViewerCountingRequestMonitor countringRm =
+ new ViewerCountingRequestMonitor(ImmediateExecutor.getInstance(), updates[i]);
+ int count = 0;
+
+ // Create a delegating update which will let the super-class fill in the
+ // standard container properties.
+ parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
+ count++;
+
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ final IProcessDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IProcessDMContext.class);
+
+ if (processService == null || procDmc == null) {
+ update.setStatus(DsfUIPlugin.newErrorStatus(IDsfStatusConstants.INVALID_HANDLE, "Service or handle invalid", null)); //$NON-NLS-1$
+ } else {
+ processService.getExecutionData(
+ procDmc,
+ new ViewerDataRequestMonitor(getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess()) {
+ fillThreadDataProperties(update, getData());
+ } else {
+ update.setStatus(getStatus());
+ }
+ countringRm.done();
+ }
+ });
+ count++;
+ }
+
+ countringRm.setDoneCount(count);
+ }
+
+ super.updatePropertiesInSessionThread(parentUpdates);
+ }
+
+ protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
+ update.setProperty(PROP_NAME, data.getName());
+ update.setProperty(ILaunchVMConstants.PROP_ID, data.getId());
+ }
+
@Override
public int getDeltaFlags(Object e) {
if (e instanceof ICommandControlShutdownDMEvent) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
index 1942e2e8a63..1dfc629c5ac 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
@@ -11,26 +11,27 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
-import org.eclipse.cdt.dsf.debug.service.IRunControl;
-import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
+import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
-import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData;
-import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractThreadVMNode;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.dsf.ui.concurrent.ViewerCountingRequestMonitor;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.ui.IMemento;
@@ -48,84 +49,57 @@ public class ThreadVMNode extends AbstractThreadVMNode
}
@Override
- protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
- for (final ILabelUpdate update : updates) {
- final IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- if (runControl == null) {
- handleFailedUpdate(update);
- continue;
- }
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
+
+ for (int i = 0; i < updates.length; i++) {
+ final IPropertiesUpdate update = updates[i];
- final IMIExecutionDMContext execDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IMIExecutionDMContext.class);
-
- String imageKey = null;
- final boolean threadSuspended;
- if (runControl.isSuspended(execDmc)) {
- threadSuspended = true;
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
+ final ViewerCountingRequestMonitor countringRm =
+ new ViewerCountingRequestMonitor(ImmediateExecutor.getInstance(), updates[i]);
+ int count = 0;
+
+ // Create a delegating update which will let the super-class fill in the
+ // standard container properties.
+ parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
+ count++;
+
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ final IProcessDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IProcessDMContext.class);
+
+ if (processService == null || procDmc == null) {
+ update.setStatus(DsfUIPlugin.newErrorStatus(IDsfStatusConstants.INVALID_HANDLE, "Service or handle invalid", null)); //$NON-NLS-1$
} else {
- threadSuspended = false;
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
- }
- update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
-
- // Find the Reason for the State
- runControl.getExecutionData(execDmc,
- new ViewerDataRequestMonitor(getSession().getExecutor(), update) {
- @Override
- public void handleCompleted(){
- if (!isSuccess()) {
- update.setLabel("", 0); //$NON-NLS-1$
- update.done();
- return;
- }
-
- final IProcesses procService = getServicesTracker().getService(IProcesses.class);
- if ( procService == null ) {
- handleFailedUpdate(update);
- return;
- }
-
- final StateChangeReason reason = getData().getStateChangeReason();
-
- // Retrieve the rest of the thread information
- final IThreadDMContext threadDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IThreadDMContext.class);
-
- procService.getExecutionData(
- threadDmc,
- new ViewerDataRequestMonitor(getSession().getExecutor(), update) {
- @Override
- public void handleCompleted() {
- // We can still generate a good enough label even if this call fails
- // so continue and check if we should use getData() or not.
-
- // Create Labels of type Thread[GDBthreadId]RealThreadID/Name (State: Reason)
- // Thread[1] 3457 (Suspended:BREAKPOINT)
- final StringBuilder builder = new StringBuilder("Thread["); //$NON-NLS-1$
- builder.append(execDmc.getThreadId());
- builder.append("] "); //$NON-NLS-1$
- if (isSuccess()) {
- builder.append(getData().getId());
- builder.append(getData().getName());
+ processService.getExecutionData(
+ procDmc,
+ new ViewerDataRequestMonitor(getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ if (isSuccess()) {
+ fillThreadDataProperties(update, getData());
+ } else {
+ final IMIExecutionDMContext execDmc = findDmcInPath(
+ update.getViewerInput(), update.getElementPath(), IMIExecutionDMContext.class);
+ if (execDmc != null) {
+ update.setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(execDmc.getThreadId()));
+ } else {
+ update.setStatus(getStatus());
}
- if(threadSuspended)
- builder.append(" (Suspended"); //$NON-NLS-1$
- else
- builder.append(" (Running"); //$NON-NLS-1$
- // Reason will be null before ContainerSuspendEvent is fired
- if(reason != null) {
- builder.append(" : "); //$NON-NLS-1$
- builder.append(reason);
- }
- builder.append(")"); //$NON-NLS-1$
- update.setLabel(builder.toString(), 0);
- update.done();
}
- });
- }
- });
+ countringRm.done();
+ }
+ });
+ count++;
+ }
+ countringRm.setDoneCount(count);
}
+ super.updatePropertiesInSessionThread(parentUpdates);
+ }
+
+ protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
+ update.setProperty(PROP_NAME, data.getName());
+ update.setProperty(ILaunchVMConstants.PROP_ID, data.getId());
}
private String produceThreadElementName(String viewName, IMIExecutionDMContext execCtx) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
index cffccb78d99..2b583b3229c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java
@@ -469,26 +469,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService
return execDmcList.toArray(new IMIExecutionDMContext[0]);
}
- /**
- * This method obtains the model data for a given IThreadDMContext object
- * which can represent a thread or a process.
- *
- * @param dmc
- * The context for which we are requesting the data
- * @param rm
- * The request monitor that will contain the requested data
- */
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- if (dmc instanceof IThreadDMContext) {
- getExecutionData((IThreadDMContext) dmc,
- (DataRequestMonitor) rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor rm) {
if (dmc instanceof IMIProcessDMContext) {
final String id = ((IMIProcessDMContext)dmc).getProcId();
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
index 8e728b2de03..f2e38630626 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java
@@ -244,20 +244,6 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IRunCont
return GdbPlugin.getBundleContext();
}
- ///////////////////////////////////////////////////////////////////////////
- // IDMService
- ///////////////////////////////////////////////////////////////////////////
-
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- if (dmc instanceof IExecutionDMContext) {
- getExecutionData((IExecutionDMContext) dmc, (DataRequestMonitor) rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
///////////////////////////////////////////////////////////////////////////
// IRunControl
///////////////////////////////////////////////////////////////////////////
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java
index 7536654de27..bc01af2fc03 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java
@@ -562,29 +562,6 @@ public class MIExpressions extends AbstractDsfService implements IExpressions, I
IFormattedValues.OCTAL_FORMAT, IFormattedValues.DECIMAL_FORMAT });
rm.done();
}
-
- /**
- * This method obtains the model data for a given ExpressionDMC object or
- * for a FormattedValueDMC, or for this DSF service.
- *
- * @param dmc
- * The context for which we are requesting the data
- * @param rm
- * The request monitor that will contain the requested data
- */
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- if (dmc instanceof MIExpressionDMC) {
- getExpressionData((MIExpressionDMC) dmc,
- (DataRequestMonitor) rm);
- } else if (dmc instanceof FormattedValueDMContext) {
- getFormattedExpressionValue((FormattedValueDMContext) dmc,
- (DataRequestMonitor) rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
/**
* Obtains the static data of an expression represented
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java
index 49d8f1c0144..fe4abf424aa 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java
@@ -399,26 +399,6 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa
return createContainerContext(processDmc, groupId);
}
- /**
- * This method obtains the model data for a given IThreadDMContext object
- * which can represent a thread or a process.
- *
- * @param dmc
- * The context for which we are requesting the data
- * @param rm
- * The request monitor that will contain the requested data
- */
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- if (dmc instanceof IThreadDMContext) {
- getExecutionData((IThreadDMContext) dmc,
- (DataRequestMonitor) rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor rm) {
if (dmc instanceof MIProcessDMC) {
rm.setData(new MIThreadDMData("", ((MIProcessDMC)dmc).getProcId())); //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
index 8a958d59eb1..39e8d7b9589 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
@@ -202,27 +202,6 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
public boolean isValid() { return true; }
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- /*
- * This is the method which is called when actual results need to be returned. We
- * can be called either with a service DMC for which we return ourselves or we can
- * be called with the DMC's we have handed out. If the latter is the case then we
- * data mine by talking to the Debug Engine.
- */
-
- if (dmc instanceof MIRegisterGroupDMC) {
- getRegisterGroupData((MIRegisterGroupDMC)dmc, (DataRequestMonitor)rm);
- } else if (dmc instanceof MIRegisterDMC) {
- getRegisterData((MIRegisterDMC)dmc, (DataRequestMonitor)rm);
- } else if (dmc instanceof FormattedValueDMContext) {
- getFormattedExpressionValue((FormattedValueDMContext)dmc, (DataRequestMonitor)rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
public void getFormattedExpressionValue(FormattedValueDMContext dmc, DataRequestMonitor rm) {
if (dmc.getParents().length == 1 && dmc.getParents()[0] instanceof MIRegisterDMC) {
getRegisterDataValue( (MIRegisterDMC) dmc.getParents()[0], dmc.getFormatID(), rm);
@@ -534,12 +513,12 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
final MIExpressions exprService = getServicesTracker().getService(MIExpressions.class);
String regName = regDmc.getName();
final IExpressionDMContext exprCtxt = exprService.createExpression(regCtx, "$" + regName); //$NON-NLS-1$
- exprService.getModelData(exprCtxt, new DataRequestMonitor(getExecutor(), rm) {
+ exprService.getExpressionData(exprCtxt, new DataRequestMonitor(getExecutor(), rm) {
@Override
protected void handleSuccess() {
// Evaluate the expression - request HEX since it works in every case
final FormattedValueDMContext valueDmc = exprService.getFormattedValueContext(exprCtxt, formatId);
- exprService.getModelData(
+ exprService.getFormattedExpressionValue(
valueDmc,
new DataRequestMonitor(getExecutor(), rm) {
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
index db8c1b74af4..e2c9b799a77 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java
@@ -314,16 +314,6 @@ public class MIRunControl extends AbstractDsfService implements IRunControl, ICa
/** @since 2.0 */
protected void setTerminated(boolean terminated) { fTerminated = terminated; }
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- if (dmc instanceof IExecutionDMContext) {
- getExecutionData((IExecutionDMContext)dmc, (DataRequestMonitor)rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
public CommandCache getCache() { return fMICommandCache; }
/** @since 2.0 */
protected ICommandControlService getConnection() { return fConnection; }
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
index a7a3c57b031..b163bba7bba 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java
@@ -208,20 +208,6 @@ public class MIStack extends AbstractDsfService
super.shutdown(rm);
}
- @SuppressWarnings("unchecked")
- public void getModelData(IDMContext dmc, DataRequestMonitor> rm) {
- if (dmc instanceof MIFrameDMC) {
- getFrameData((MIFrameDMC)dmc, (DataRequestMonitor)rm);
- // getFrameData invokes rm
- } else if (dmc instanceof MIVariableDMC) {
- getVariableData((MIVariableDMC)dmc, (DataRequestMonitor)rm);
- // getVariablesData invokes rm
- } else {
- rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
- rm.done();
- }
- }
-
/**
* Creates a frame context. This method is intended to be used by other MI
* services and sub-classes which need to create a frame context directly.
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java
index 8d758797f43..337c267e2dc 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java
@@ -20,13 +20,7 @@ public class MessagesForNumberFormatDetailPane extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.numberformat.detail.messages"; //$NON-NLS-1$
- public static String NumberFormatDetailPane_Natural_label;
- public static String NumberFormatDetailPane_Decimal_label;
- public static String NumberFormatDetailPane_Hex_label;
- public static String NumberFormatDetailPane_Octal_label;
- public static String NumberFormatDetailPane_Binary_label;
- public static String NumberFormatDetailPane_String_label;
- public static String NumberFormatDetailPane_Other_label;
+ public static String NumberFormatDetailPane_format_separator__label;
public static String NumberFormatDetailPane_Name_label;
public static String NumberFormatDetailPane_Spaces_label;
public static String NumberFormatDetailPane_CarriageReturn_label;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java
index 22156dfee53..b11b9949b40 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java
@@ -12,44 +12,38 @@
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.numberformat.detail;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Executor;
-import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneMaxLengthAction;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneWordWrapAction;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane;
import org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction;
-import org.eclipse.cdt.dsf.debug.service.IExpressions;
-import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
-import org.eclipse.cdt.dsf.debug.service.IRegisters;
-import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
-import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
-import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
-import org.eclipse.cdt.dsf.debug.service.IFormattedValues.IFormattedDataDMContext;
-import org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMContext;
-import org.eclipse.cdt.dsf.debug.service.IRegisters.IBitFieldDMData;
-import org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMContext;
-import org.eclipse.cdt.dsf.debug.service.IRegisters.IRegisterDMData;
import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.IDebugVMConstants;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat.FormattedValueVMUtil;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
-import org.eclipse.cdt.dsf.service.DsfServicesTracker;
-import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
-import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
-import org.eclipse.cdt.dsf.ui.viewmodel.update.AbstractCachingVMProvider;
+import org.eclipse.cdt.dsf.ui.concurrent.SimpleDisplayExecutor;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.IElementPropertiesProvider;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMPropertiesUpdate;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IDebugModelProvider;
import org.eclipse.debug.core.model.IValue;
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.TreeModelViewer;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -249,35 +243,12 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
/**
* Useful shortened names for the internationalized strings.
*/
- public static String HEX = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Hex_label;
- public static String NATURAL = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Natural_label;
- public static String DECIMAL = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Decimal_label;
- public static String OCTAL = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Octal_label;
- public static String BINARY = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Binary_label;
- public static String STRING = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_String_label;
- public static String OTHER = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_String_label;
+ public static String FORMAT_SEPARATOR = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_format_separator__label;
public static String NAME = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Name_label;
public static String SPACES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Spaces_label;
public static String CRLF = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_CarriageReturn_label;
public static String DOTS = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_DotDotDot_label;
- /*
- * Returns a formatted combination of format label and its corresponding value.
- */
- private String formatNumericResult(String format, String value) {
-
- /*
- * Select the proper string format and create the total value to be displayed.
- */
- if ( format == IFormattedValues.HEX_FORMAT) { return(HEX + value); }
- else if ( format == IFormattedValues.OCTAL_FORMAT) { return(OCTAL + value); }
- else if ( format == IFormattedValues.NATURAL_FORMAT) { return(NATURAL + value); }
- else if ( format == IFormattedValues.BINARY_FORMAT) { return(BINARY + value); }
- else if ( format == IFormattedValues.DECIMAL_FORMAT) { return(DECIMAL + value); }
- else if ( format == IFormattedValues.STRING_FORMAT) { return(STRING + value); }
- else { return(OTHER + value); }
- }
-
/**
* Job to compute the details for a selection
*/
@@ -299,142 +270,11 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
fElements = elements;
}
- /*
- * This is the routine which will actually process the various format requests
- * for a given element. It is expected and required that this routine will be
- * called from within a DSF executor.
- */
- private void putInformationIntoDetailPane( final AbstractCachingVMProvider provider,
- final IVMNode node,
- final TreePath path,
- final IFormattedDataDMContext finalDmc ,
- final IFormattedValues service,
- final IProgressMonitor monitor,
- final String name ) {
-
- /*
- * Now that we can process this one. Find out how many formats we can
- * show this in. We will choose to show all of the supported formats.
- * Since we are doing this in the background and the debug engines do
- * typically cache the results so producing multiple formats will not
- * typically be a burden. We should probably consider perhaps doing a
- * preference where they can select what formats they want to show.
- */
- final DataRequestMonitor getAvailableFormatsDone =
- new DataRequestMonitor(service.getExecutor(), null) {
- @Override
- protected void handleSuccess() {
- if (monitor.isCanceled()) {
- notifyAll();
- return;
- }
-
- /*
- * Now we have a set of formats for each one fire up an independent
- * asynchronous request to get the data in that format. We do not
- * go through the cache manager here because when the values are
- * edited and written the cache is bypassed.
- */
- String[] formats = getData();
-
- final List completedFormatStrings = new ArrayList();
-
- final CountingRequestMonitor countingRm = new CountingRequestMonitor(service.getExecutor(), null) {
- @Override
- protected void handleCompleted() {
-
- if (monitor.isCanceled()) {
- notifyAll();
- return;
- }
-
- /*
- * We sort the array to make the strings appear always in the same order.
- */
- java.util.Collections.sort( completedFormatStrings );
-
- int len = completedFormatStrings.size() ;
-
- if ( len == 0 ) {
- detailComputed(null,""); //$NON-NLS-1$
- }
- else {
- /*
- * Add the HEADER which identifies what is being represented. When there
- * are multiple selections in the view the detail pane contains multiple
- * entries. They would be all compressed together and even though the
- * order of the entries is the order of the selections in the view and
- * it is very hard to know what goes with what. This makes it easy.
- */
- String finalResult = NAME + name + CRLF;
- int cnt = 0 ;
-
- for (String str : completedFormatStrings) {
-
- finalResult += SPACES + str ;
-
- if ( ( ++ cnt ) < len ) {
- finalResult += CRLF;
- }
- }
-
- detailComputed(null,finalResult);
- }
- }
- };
-
- countingRm.setDoneCount(formats.length);
-
- for ( final String str : formats ) {
- /*
- * Format has been validated. Get the formatted value.
- */
- final FormattedValueDMContext valueDmc = service.getFormattedValueContext(finalDmc, str);
-
- provider.getModelData(
- node,
- new IViewerUpdate() {
- public void cancel() {}
- public void done() {}
- public Object getViewerInput() { return fViewerInput; }
- public TreePath getElementPath() { return path; }
- public Object getElement() { return path.getLastSegment(); }
- public IPresentationContext getPresentationContext() { return fPresentationContext; }
- public boolean isCanceled() { return monitor.isCanceled(); }
- public void setStatus(IStatus status) {}
- public IStatus getStatus() { return null; }
- },
- service, valueDmc,
- new DataRequestMonitor(service.getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (getStatus().isOK()) {
- /*
- * Show the information indicating the format.
- */
- completedFormatStrings.add( formatNumericResult( str, getData().getFormattedValue() ) );
- }
- countingRm.done();
- }
- },
- provider.getExecutor());
- }
- }
- };
-
- /*
- * Get the supported formats.
- */
- service.getAvailableFormats(finalDmc, getAvailableFormatsDone);
- }
-
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected IStatus run(final IProgressMonitor monitor) {
-
- String message = null;
if ( fMonitor != null && ! fMonitor.isCanceled() ) {
fMonitor.setCanceled(true);
}
@@ -447,158 +287,62 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert
final TreePath path = paths[i];
Object element = paths[i].getLastSegment();
- /*
- * Make sure this is an element we want to deal with.
- */
- if ( element instanceof IDMVMContext) {
- IDMVMContext vmc = (IDMVMContext)element;
- /*
- * We are specifically looking to support the following Data Model Contexts
- *
- * IRegisterDMContext
- * IBitFieldDMContext
- * IExpressionDMContext
- *
- * At first you might think that we should just use the service which is
- * associated with the dmc. But there are implementations where the data
- * model contexts are extended but the services do not extend each other
- * ( this is the case with the WindRiver OCD extensions for example ).
- *
- * So here we specifically look for the service which knows how to deal
- * with the formatted data.
- *
- * Please note that the order or searching for the ancestor is important.
- * A BitField Data Model Context will have a Register Data Model Context
- * as its parent so if we search for a Register DMC first when we actually
- * have a BitField DMC we will get the register and show the value of the
- * register not the bit field.
- */
-
- DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), vmc.getDMContext().getSessionId());
-
- final AbstractCachingVMProvider provider = (AbstractCachingVMProvider)vmc.getAdapter(AbstractCachingVMProvider.class);
- final IVMNode node = (IVMNode)vmc.getAdapter(IVMNode.class);
-
- final IBitFieldDMContext bitfieldDmc = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(), IBitFieldDMContext.class);
- if ( bitfieldDmc != null ) {
- /*
- * Get the name so we can construct the header which identifies the detail
- * set of values.
- */
- final IRegisters regService = tracker.getService(IRegisters.class);
-
- regService.getExecutor().submit(
- new Runnable() {
- public void run() {
- regService.getBitFieldData(
- bitfieldDmc,
- new DataRequestMonitor(regService.getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (getStatus().isOK()) {
- putInformationIntoDetailPane(provider, node, path, bitfieldDmc , regService, monitor, getData().getName());
- }
- }
- }
- );
- }
- }
- );
- }
- else {
- final IRegisterDMContext regDmc = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(), IRegisterDMContext.class);
-
- if ( regDmc != null ) {
- /*
- * Get the name so we can construct the header which identifies the detail
- * set of values.
- */
- final IRegisters regService = tracker.getService(IRegisters.class);
-
- regService.getExecutor().submit(
- new Runnable() {
- public void run() {
- regService.getRegisterData(
- regDmc,
- new DataRequestMonitor(regService.getExecutor(), null) {
- @Override
- public void handleCompleted() {
- if (getStatus().isOK()) {
- putInformationIntoDetailPane(provider, node, path, regDmc , regService, monitor, getData().getName());
- }
- }
- }
- );
- }
- }
- );
- }
- else {
- final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(((IDMVMContext) element).getDMContext(), IExpressionDMContext.class);
-
- if ( exprDmc != null ) {
- final IExpressions exprService = tracker.getService(IExpressions.class);;
-
- exprService.getExecutor().submit(
- new Runnable() {
- public void run() {
- putInformationIntoDetailPane(provider, node, path, exprDmc , exprService, monitor, exprDmc.getExpression());
- }
- }
- );
- }
- else {
- /*
- * For whatever reason we are seeing some form of context we do not handle. So we
- * will skip this one and try and process any remaining ones. At least this way
- * we can fill the detail pane with those we do understand.
- */
- continue;
- }
- }
- }
-
- tracker.dispose();
-
- /*
- * We need to wait until all the values are in. This causes the work
- * to in effect be synchronous, but if we do not wait then when we
- * are stepping fast if we exit before the job is finished then we
- * will enter and start to update the pane before the previous work
- * is actually done. This causes the data to be screwed up in an
- * overlapped way. It should be the case that most of the jobs that
- * occur in the middle will be cancelled, so there is not a lot of
- * waste actually going on.
- */
- synchronized (this) {
- try {
- // wait for a max of 30 seconds for result, then cancel
- wait(30000);
- if (!fComputed) {
- fMonitor.setCanceled(true);
- }
- } catch (InterruptedException e) {
- break;
- }
- }
- }
- else {
- if (element instanceof String) { message = (String) element; }
- else { message = element.toString(); }
- fComputed = true;
- }
+ final IElementPropertiesProvider propertiesProvider =
+ (IElementPropertiesProvider)DebugPlugin.getAdapter(element, IElementPropertiesProvider.class);
- /*
- * If no details were computed for the selected variable, clear the pane
- * or use the message.
- */
- if (!fComputed){
- if (message == null) {
- detailComputed(null,""); //$NON-NLS-1$
- } else {
- detailComputed(null, message);
- }
- }
+ final Executor executor = SimpleDisplayExecutor.getSimpleDisplayExecutor(
+ fWorkbenchPartSite.getShell().getDisplay());
+ Set properties = new HashSet(1);
+ properties.add(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS);
+ propertiesProvider.update(new IPropertiesUpdate[] { new VMPropertiesUpdate(
+ properties, path, fViewerInput, fPresentationContext,
+ new DataRequestMonitor
*/
public synchronized void done() {
+ setSubmitted();
+
if (fDone) {
throw new IllegalStateException("RequestMonitor: " + this + ", done() method called more than once"); //$NON-NLS-1$//$NON-NLS-2$
}
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/IDMService.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/IDMService.java
deleted file mode 100644
index e6cf2697608..00000000000
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/IDMService.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.dsf.datamodel;
-
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.service.IDsfService;
-
-/**
- * Interface for DSF services that provide model data to clients.
- *
- * For completeness this service interface derives from IDMData
- * and has a method which allows clients to retrieve the DM Context that
- * represents the service data.
- *
- * @deprecated Without getModelData method this service has no function.
- * There's also no need for it as a marker interface so we may as well
- * get rid of it.
- *
- * @since 1.0
- */
-public interface IDMService extends IDsfService {
- /**
- * Retrieves model data object for given context. This method makes it
- * un-necessary for every model service to declare a separate method
- * for retrieving model data of specific type.
- *
- * @param The Data Model Data type that is to be retrieved.
- * @param dmc Data Model Context for the data model data object to be retrieved.
- * @param rm Request completion monitor to be filled in with the Data Model Data.
- *
- * @deprecated This method is now deprecated as there is no compile-time linking
- * between IDMContext and IDMData objects (see bug 205132)
- */
- @Deprecated
- void getModelData(IDMContext dmc, DataRequestMonitor> rm);
-}
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IDsfBreakpointExtension.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IDsfBreakpointExtension.java
index fadd7b33796..9a7ee5314fc 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IDsfBreakpointExtension.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IDsfBreakpointExtension.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.service;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IFormattedValues.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IFormattedValues.java
index 31dc1493c02..768fd0ed05c 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IFormattedValues.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IFormattedValues.java
@@ -15,7 +15,7 @@ import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.datamodel.AbstractDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMData;
-import org.eclipse.cdt.dsf.datamodel.IDMService;
+import org.eclipse.cdt.dsf.service.IDsfService;
/**
* Formatted values interface describes the kinds of formatted information
@@ -24,7 +24,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMService;
*
* @since 1.0
*/
-public interface IFormattedValues extends IDMService {
+public interface IFormattedValues extends IDsfService {
/** Marker interface for a DMC that has a formatted value. */
public interface IFormattedDataDMContext extends IDMContext {}
@@ -78,7 +78,7 @@ public interface IFormattedValues extends IDMService {
{
private final String fFormatID;
- public FormattedValueDMContext(IDMService service, IDMContext parent, String formatId) {
+ public FormattedValueDMContext(IDsfService service, IDMContext parent, String formatId) {
super(service, new IDMContext[] { parent });
fFormatID = formatId;
}
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IProcesses.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IProcesses.java
index 14a798380ee..680f0f83082 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IProcesses.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IProcesses.java
@@ -18,7 +18,7 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMData;
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
-import org.eclipse.cdt.dsf.datamodel.IDMService;
+import org.eclipse.cdt.dsf.service.IDsfService;
/**
* This interface provides access to the OS's process
@@ -29,7 +29,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMService;
*
* @since 1.1
*/
-public interface IProcesses extends IDMService {
+public interface IProcesses extends IDsfService {
/**
* A thread as known by the OS.
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java
index 6a09d97fc82..15fc8a2355e 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IRunControl.java
@@ -16,7 +16,7 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMData;
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
-import org.eclipse.cdt.dsf.datamodel.IDMService;
+import org.eclipse.cdt.dsf.service.IDsfService;
/**
* This interface provides access to controlling and monitoring the execution
@@ -28,7 +28,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMService;
*
* @since 1.0
*/
-public interface IRunControl extends IDMService
+public interface IRunControl extends IDsfService
{
/**
* Execution context is the object on which run control operations can be
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IStack.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IStack.java
index 0dc480e7397..d549d2a9a60 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IStack.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IStack.java
@@ -14,7 +14,7 @@ import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMData;
-import org.eclipse.cdt.dsf.datamodel.IDMService;
+import org.eclipse.cdt.dsf.service.IDsfService;
/**
* Stack service provides access to stack information for a
@@ -22,7 +22,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMService;
*
* @since 1.0
*/
-public interface IStack extends IDMService {
+public interface IStack extends IDsfService {
/**
* Context for a specific stack frame. Besides allowing access to stack
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/ISymbols.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/ISymbols.java
index f66b63a52fb..f2bea733ccd 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/ISymbols.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/ISymbols.java
@@ -14,7 +14,7 @@ import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.datamodel.IDMData;
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
-import org.eclipse.cdt.dsf.datamodel.IDMService;
+import org.eclipse.cdt.dsf.service.IDsfService;
/**
* Service for accessing debugger symbols. This service builds on the Modules
@@ -24,7 +24,7 @@ import org.eclipse.cdt.dsf.datamodel.IDMService;
* @see IModules
* @since 1.0
*/
-public interface ISymbols extends IDMService {
+public interface ISymbols extends IDsfService {
public interface ISymbolObjectDMContext extends IDMContext {}
/**
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java
index 572a2f012f0..630955b936c 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java
@@ -82,6 +82,10 @@ abstract public class AbstractDsfService
fTracker = null;
rm.done();
}
+
+ public boolean isActive() {
+ return getServiceRegistration() != null;
+ }
/** Returns the session object for this service */
public DsfSession getSession() { return fSession; }
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/IDsfService.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/IDsfService.java
index 5147fdbb84e..13982031b64 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/IDsfService.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/IDsfService.java
@@ -44,24 +44,24 @@ public interface IDsfService {
* Property name for the session-id of this service. This property should be set by
* all DSF services when they are registered with OSGI service framework.
*/
- final static String PROP_SESSION_ID = "org.eclipse.cdt.dsf.service.IService.session_id"; //$NON-NLS-1$
+ public final static String PROP_SESSION_ID = "org.eclipse.cdt.dsf.service.IService.session_id"; //$NON-NLS-1$
/**
* Returns the DSF Session that this service belongs to.
*/
- DsfSession getSession();
+ public DsfSession getSession();
/**
* Returns the executor that should be used to call methods of this service.
* This method is equivalent to calling getSession().getExecutor()
*/
- DsfExecutor getExecutor();
+ public DsfExecutor getExecutor();
/**
* Returns the map of properties that this service was registered with.
*/
@SuppressWarnings("unchecked")
- Dictionary getProperties();
+ public Dictionary getProperties();
/**
* Returns a filter string that can be used to uniquely identify this
@@ -69,7 +69,7 @@ public interface IDsfService {
* name, which were used to register this service.
* @see org.osgi.framework.BundleContext#getServiceReferences
*/
- String getServiceFilter();
+ public String getServiceFilter();
/**
* Performs initialization and registration of the given service. Implementation
@@ -81,13 +81,23 @@ public interface IDsfService {
* initializaiton should fail.
* @param requestMonitor callback to be submitted when the initialization is complete
*/
- void initialize(RequestMonitor requestMonitor);
+ public void initialize(RequestMonitor requestMonitor);
/**
* Performs shutdown and de-registration of the given service.
* @param requestMonitor callback to be submitted when shutdown is complete
*/
- void shutdown(RequestMonitor requestMonitor);
+ public void shutdown(RequestMonitor requestMonitor);
+
+ /**
+ * Returns whether the service is currently active. A service should be
+ * active after it is initialized and before it has been shut down.
+ *
+ * @return true
if active
+ *
+ * @since 2.0
+ */
+ public boolean isActive();
/**
* Returns the startup order number of this service among services in the same session.
@@ -97,5 +107,5 @@ public interface IDsfService {
* @return startup order number of this service
* @see org.eclipse.cdt.dsf.service.DsfSession#getAndIncrementServiceStartupCounter()
*/
- int getStartupNumber();
+ public int getStartupNumber();
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
index 043f4bc9f08..7b4ba3c7a1a 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
@@ -11,24 +11,22 @@
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.launch;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
-import org.eclipse.cdt.dsf.debug.service.IRunControl;
-import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData;
-import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractThreadVMNode;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
import org.eclipse.cdt.dsf.service.DsfSession;
-import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
-import org.eclipse.cdt.examples.dsf.pda.service.PDARunControl;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
import org.eclipse.cdt.examples.dsf.pda.service.PDAThreadDMContext;
+import org.eclipse.cdt.examples.dsf.pda.ui.PDAUIPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.ui.IMemento;
@@ -50,68 +48,16 @@ public class PDAThreadsVMNode extends AbstractThreadVMNode
}
@Override
- protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
- for (final ILabelUpdate update : updates) {
- final PDARunControl runControl = getServicesTracker().getService(PDARunControl.class);
- if ( runControl == null ) {
- handleFailedUpdate(update);
- continue;
- }
-
- final PDAThreadDMContext dmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), PDAThreadDMContext.class);
-
- String imageKey = null;
- if (getServicesTracker().getService(IRunControl.class).isSuspended(dmc)) {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ for (int i = 0; i < updates.length; i++) {
+ final PDAThreadDMContext dmc = findDmcInPath(updates[i].getViewerInput(), updates[i].getElementPath(), PDAThreadDMContext.class);
+ if (dmc != null) {
+ updates[i].setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(dmc.getID()));
} else {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
+ updates[i].setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
}
- update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
-
- // Find the Reason for the State
- getDMVMProvider().getModelData(
- this, update, runControl, dmc,
- new ViewerDataRequestMonitor(getSession().getExecutor(), update) {
- @Override
- public void handleCompleted(){
- if (!isSuccess()) {
- update.setLabel("", 0);
- update.done();
- return;
- }
-
- // We're in a new dispatch cycle, and we have to check whether the
- // service reference is still valid.
- final PDARunControl runControl = getServicesTracker().getService(PDARunControl.class);
- if ( runControl == null ) {
- handleFailedUpdate(update);
- return;
- }
-
- final StateChangeReason reason = getData().getStateChangeReason();
-
- // Create Labels of type Thread[GDBthreadId]RealThreadID/Name (State: Reason)
- // Thread[1] 3457 (Suspended:BREAKPOINT)
- final StringBuilder builder = new StringBuilder();
- builder.append("Thread ");
- builder.append(dmc.getID());
- if(getServicesTracker().getService(IRunControl.class).isSuspended(dmc))
- builder.append(" (Suspended");
- else
- builder.append(" (Running");
- // Reason will be null before ContainerSuspendEvent is fired
- if(reason != null) {
- builder.append(" : ");
- builder.append(reason);
- }
- builder.append(")");
- update.setLabel(builder.toString(), 0);
- update.done();
- }
- },
- getExecutor());
-
}
+ super.updatePropertiesInSessionThread(updates);
}
private String produceThreadElementName(String viewName, PDAThreadDMContext execCtx) {
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
index 62b57922fa3..415215349e8 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
@@ -13,17 +13,24 @@
package org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.launch;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractContainerVMNode;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
import org.eclipse.cdt.examples.dsf.pda.service.PDACommandControl;
+import org.eclipse.cdt.examples.dsf.pda.service.PDAThreadDMContext;
import org.eclipse.cdt.examples.dsf.pda.service.PDAVirtualMachineDMContext;
+import org.eclipse.cdt.examples.dsf.pda.ui.PDAUIPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
@@ -70,70 +77,22 @@ public class PDAVirtualMachineVMNode extends AbstractContainerVMNode
update.done();
}
-
@Override
- protected void updateLabelInSessionThread(final ILabelUpdate update) {
- // Get a reference to the run control service.
- final IRunControl runControl = getServicesTracker().getService(IRunControl.class);
- if (runControl == null) {
- handleFailedUpdate(update);
- return;
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ for (int i = 0; i < updates.length; i++) {
+ // Find the PDA program context.
+ final PDAVirtualMachineDMContext dmc =
+ findDmcInPath(updates[i].getViewerInput(), updates[i].getElementPath(), PDAVirtualMachineDMContext.class);
+ if (dmc != null) {
+ updates[i].setProperty(PROP_NAME, "PDA");
+ updates[i].setProperty(ILaunchVMConstants.PROP_ID, dmc.getProgram());
+ } else {
+ updates[i].setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
+ }
}
-
- // Find the PDA program context.
- final PDAVirtualMachineDMContext programCtx =
- findDmcInPath(update.getViewerInput(), update.getElementPath(), PDAVirtualMachineDMContext.class);
-
- // Call service to get current program state
- final boolean isSuspended = runControl.isSuspended(programCtx);
-
- // Set the program icon based on the running state of the program.
- String imageKey = null;
- if (isSuspended) {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
- } else {
- imageKey = IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
- }
- update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
-
- // Retrieve the last state change reason
- getDMVMProvider().getModelData(
- this, update, runControl, programCtx,
- new ViewerDataRequestMonitor(ImmediateExecutor.getInstance(), update)
- {
- @Override
- public void handleCompleted(){
- // If the request failed, fail the udpate.
- if (!isSuccess()) {
- handleFailedUpdate(update);
- return;
- }
-
- // Compose the thread name string.
- final StringBuilder builder = new StringBuilder();
-
- builder.append("PDA [");
- builder.append(programCtx.getProgram());
- builder.append("]");
-
- if(isSuspended) {
- builder.append(" (Suspended");
- } else {
- builder.append(" (Running");
- }
- // Reason will be null before ContainerSuspendEvent is fired
- if(getData().getStateChangeReason() != null) {
- builder.append(" : ");
- builder.append(getData().getStateChangeReason());
- }
- builder.append(")");
- update.setLabel(builder.toString(), 0);
- update.done();
- }
- },
- getExecutor());
+ super.updatePropertiesInSessionThread(updates);
}
-
+
private String produceProgramElementName( String viewName , PDAVirtualMachineDMContext execCtx ) {
return "PDA." + execCtx.getProgram(); //$NON-NLS-1$
}