From 1e0365550e500ad79c80196fb434ebc80ff48d96 Mon Sep 17 00:00:00 2001
From: Pawel Piech
Date: Tue, 17 Jun 2008 20:46:30 +0000
Subject: [PATCH] [202649] - [update policy][debug view] Add manual refresh
mode for thread list in debug view.
---
.../plugin.properties | 1 +
.../org.eclipse.dd.dsf.debug.ui/plugin.xml | 35 ++++
.../expression/ExpressionManagerVMNode.java | 5 +
.../launch/AbstractLaunchVMProvider.java | 7 +-
.../launch/AbstractThreadVMNode.java | 2 +-
.../DelayedStackRefreshUpdatePolicy.java | 154 +++++++++++++-----
.../ui/viewmodel/launch/LaunchRootVMNode.java | 5 +
.../launch/LaunchVMUpdateMessages.java | 26 +++
.../viewmodel/launch/StackFramesVMNode.java | 5 +
.../launch/StandardProcessVMNode.java | 5 +
.../ui/viewmodel/modules/ModulesVMNode.java | 6 +
.../register/RegisterBitFieldVMNode.java | 6 +
.../register/RegisterGroupVMNode.java | 7 +-
.../ui/viewmodel/register/RegisterVMNode.java | 5 +
.../ui/viewmodel/variable/VariableVMNode.java | 5 +
.../DefaultVMModelProxyStrategy.java | 10 +-
.../eclipse/dd/dsf/ui/viewmodel/VMDelta.java | 21 ++-
.../ui/viewmodel/datamodel/RootDMVMNode.java | 6 +
.../update/AbstractCachingVMProvider.java | 36 ++--
.../update/AutomaticUpdatePolicy.java | 5 +
.../viewmodel/update/ManualUpdatePolicy.java | 15 ++
.../update/UpdatePolicyDecorator.java | 39 +++++
.../examples/dsf/filebrowser/FileVMNode.java | 6 +
.../filebrowser/FilesystemRootsVMNode.java | 5 +
.../dd/examples/dsf/timers/AlarmsVMNode.java | 6 +
.../dd/examples/dsf/timers/TimersVMNode.java | 5 +
.../examples/dsf/timers/TriggersVMNode.java | 5 +
.../dd/examples/pda/ui/PDAAdapterFactory.java | 10 ++
.../ui/viewmodel/launch/PDAThreadsVMNode.java | 81 ++++-----
.../launch/PDAVirtualMachineVMNode.java | 37 ++---
.../pda/service/PDACommandControl.java | 27 ++-
.../ui/viewmodel/launch/ContainerVMNode.java | 7 +-
.../ui/viewmodel/launch/ThreadVMNode.java | 7 +-
33 files changed, 467 insertions(+), 135 deletions(-)
create mode 100644 plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchVMUpdateMessages.java
create mode 100644 plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/UpdatePolicyDecorator.java
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties
index 98a34748e9b..105302d2f3b 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.properties
@@ -31,6 +31,7 @@ action.breakpointProperties.label = Breakpoint Properties...
action.refresh.label = Refresh
menu.updatePolicy = Update Policy
+menu.threadsUpdatePolicy = Threads Update Policy
action.breakpointHitUpdatePolicy.label = Breakpoint Hit
action.manualUpdatePolicy.label = Manual
action.automaticUpdatePolicy.label = Automatic
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml
index da05a0c16df..24bc8a47f02 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/plugin.xml
@@ -319,6 +319,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ * The underlying base update policy is considered for container contexts only.
+ *
*/
-public class DelayedStackRefreshUpdatePolicy extends AutomaticUpdatePolicy {
+public class DelayedStackRefreshUpdatePolicy extends UpdatePolicyDecorator {
private static final class DelayedStackRefreshUpdateTester implements IElementUpdateTester {
- private final boolean fLazyMode;
- DelayedStackRefreshUpdateTester(boolean lazyMode) {
- fLazyMode= lazyMode;
+ private final IElementUpdateTester fBaseTester;
+
+ /** Indicates whether only the top stack frame should be updated */
+ private final boolean fLazyStackFrameMode;
+
+ DelayedStackRefreshUpdateTester(IElementUpdateTester baseTester, boolean lazyStackFrameMode) {
+ fBaseTester = baseTester;
+ fLazyStackFrameMode = lazyStackFrameMode;
}
public int getUpdateFlags(Object viewerInput, TreePath path) {
- if (fLazyMode) {
- Object element = path.getSegmentCount() != 0 ? path.getLastSegment() : viewerInput;
- if (element instanceof IDMVMContext) {
- IDMContext dmc= ((IDMVMContext) element).getDMContext();
+ Object element = path.getSegmentCount() != 0 ? path.getLastSegment() : viewerInput;
+ if (element instanceof IDMVMContext) {
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+ if (fLazyStackFrameMode) {
if (dmc instanceof IFrameDMContext) {
- if (((IFrameDMContext) dmc).getLevel() > 0) {
- // mark as dirty only
- return DIRTY;
- } else {
+ if (((IFrameDMContext) dmc).getLevel() == 0) {
return FLUSH;
}
} else if (dmc instanceof IExecutionDMContext) {
- return DIRTY;
+ return fBaseTester.getUpdateFlags(viewerInput, path);
}
+ return DIRTY;
+ } else if (dmc instanceof IContainerDMContext) {
+ return fBaseTester.getUpdateFlags(viewerInput, path);
}
}
return FLUSH;
@@ -55,50 +67,106 @@ public class DelayedStackRefreshUpdatePolicy extends AutomaticUpdatePolicy {
public boolean includes(IElementUpdateTester tester) {
// A non-lazy tester includes a lazy tester, but not vice versa.
// This allows entries that were marked as dirty by a flush with
- // the lazy mode to be superceded by a non-lazy update which
+ // the lazy mode to be superseded by a non-lazy update which
// actually clears the entries that were marked as dirty.
if (tester instanceof DelayedStackRefreshUpdateTester) {
DelayedStackRefreshUpdateTester sfTester = (DelayedStackRefreshUpdateTester)tester;
- if (fLazyMode) {
- return sfTester.fLazyMode;
+ if (fLazyStackFrameMode) {
+ if (sfTester.fLazyStackFrameMode) {
+ return fBaseTester.includes(sfTester.fBaseTester);
+ }
} else {
- return false;
+ if (!sfTester.fLazyStackFrameMode) {
+ return fBaseTester.includes(sfTester.fBaseTester);
+ }
+ // non-lazy includes lazy
+ return true;
}
}
return false;
}
+
+ @Override
+ public String toString() {
+ return "Delayed stack refresh (lazy = " + fLazyStackFrameMode + ", base = " + fBaseTester + ") update tester"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
}
- public static String DELAYED_UPDATE_POLICY_ID= "org.eclipse.dd.dsf.ui.viewmodel.update.lazyUpdatePolicy"; //$NON-NLS-1$
+ private static final class ThreadsUpdateTester implements IElementUpdateTester {
- private static final DelayedStackRefreshUpdateTester fgLazyUpdateTester= new DelayedStackRefreshUpdateTester(true);
- private static final DelayedStackRefreshUpdateTester fgNonLazyUpdateTester= new DelayedStackRefreshUpdateTester(false);
+ private final IElementUpdateTester fBaseTester;
+
+ private final boolean fRefreshAll;
+
+ ThreadsUpdateTester(IElementUpdateTester baseTester, boolean refreshAll) {
+ fBaseTester = baseTester;
+ fRefreshAll = refreshAll;
+ }
+
+ public int getUpdateFlags(Object viewerInput, TreePath path) {
+ Object element = path.getSegmentCount() != 0 ? path.getLastSegment() : viewerInput;
+
+ if (!fRefreshAll && element instanceof IDMVMContext) {
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+ if (dmc instanceof IContainerDMContext) {
+ return fBaseTester.getUpdateFlags(viewerInput, path);
+ }
+ }
+
+ // If the element is not a container or if the flush all flag is set,
+ // always flush it.
+ return FLUSH;
+ }
+
+ public boolean includes(IElementUpdateTester tester) {
+ // A refresh-all tester includes a non-refresh-all tester, but not
+ // vice versa. This allows entries that were marked as dirty by
+ // a flush with
+ // the non-refresh-all to be superseded by a refresh-all update which
+ // actually clears the entries that were marked as dirty.
+ if (tester instanceof ThreadsUpdateTester) {
+ ThreadsUpdateTester threadsTester = (ThreadsUpdateTester)tester;
+ if (fRefreshAll) {
+ if (threadsTester.fRefreshAll) {
+ return fBaseTester.includes(threadsTester.fBaseTester);
+ }
+ // refresh-all includes the non-refresh-all
+ return true;
+ } else {
+ if (!threadsTester.fRefreshAll) {
+ return fBaseTester.includes(threadsTester.fBaseTester);
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "Threads update tester (base = " + fBaseTester + ") update tester"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+
+ public DelayedStackRefreshUpdatePolicy(IVMUpdatePolicy base) {
+ super(base);
+ }
@Override
public IElementUpdateTester getElementUpdateTester(Object event) {
if (event instanceof ISuspendedDMEvent) {
- return fgLazyUpdateTester;
+ return new DelayedStackRefreshUpdateTester(getBaseUpdatePolicy().getElementUpdateTester(event), true);
} else if (event instanceof FullStackRefreshEvent) {
- return fgNonLazyUpdateTester;
+ return new DelayedStackRefreshUpdateTester(getBaseUpdatePolicy().getElementUpdateTester(event), false);
+ } else if (event instanceof IExitedDMEvent &&
+ ((IExitedDMEvent)event).getDMContext() instanceof IContainerDMContext)
+ {
+ // container exit should always trigger a refresh
+ return new ThreadsUpdateTester(super.getElementUpdateTester(event), true);
} else {
- return super.getElementUpdateTester(event);
+ return new ThreadsUpdateTester(super.getElementUpdateTester(event), false);
}
}
- /*
- * @see org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy#getID()
- */
- @Override
- public String getID() {
- return DELAYED_UPDATE_POLICY_ID;
- }
-
- /*
- * @see org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy#getName()
- */
- @Override
- public String getName() {
- return "Delayed Stack Refresh"; //$NON-NLS-1$
- }
-
}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchRootVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchRootVMNode.java
index 00027d407ec..5b50c5d5108 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchRootVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchRootVMNode.java
@@ -55,6 +55,11 @@ public class LaunchRootVMNode extends RootVMNode
super(provider);
}
+ @Override
+ public String toString() {
+ return "LaunchRootVMNode"; //$NON-NLS-1$
+ }
+
@Override
public boolean isDeltaEvent(Object rootObject, Object e) {
if (e instanceof DebugEvent) {
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchVMUpdateMessages.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchVMUpdateMessages.java
new file mode 100644
index 00000000000..f298c6f3e4f
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/LaunchVMUpdateMessages.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 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.dd.dsf.debug.internal.provisional.ui.viewmodel.launch;
+
+import org.eclipse.osgi.util.NLS;
+
+public class LaunchVMUpdateMessages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.LaunchVMUpdateMessages";//$NON-NLS-1$
+
+ public static String ThreadsAutomaticUpdatePolicy_name;
+ public static String ThreadsManualUpdatePolicy_name;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, LaunchVMUpdateMessages.class);
+ }
+}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StackFramesVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StackFramesVMNode.java
index f050bf66f60..1cba86f8da2 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StackFramesVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StackFramesVMNode.java
@@ -58,6 +58,11 @@ public class StackFramesVMNode extends AbstractDMVMNode
super(provider, session, IStack.IFrameDMContext.class);
}
+ @Override
+ public String toString() {
+ return "StackFramesVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMNode#updateHasElementsInSessionThread(org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate)
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StandardProcessVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StandardProcessVMNode.java
index fd442730382..f3b16d9d3b3 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StandardProcessVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/launch/StandardProcessVMNode.java
@@ -89,6 +89,11 @@ public class StandardProcessVMNode extends AbstractVMNode {
super(provider);
}
+ @Override
+ public String toString() {
+ return "StandardProcessVMNode"; //$NON-NLS-1$
+ }
+
public void update(IChildrenUpdate[] updates) {
for (IChildrenUpdate update : updates) {
ILaunch launch = findLaunch(update.getElementPath());
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java
index 17d35011553..8bdfaab9a72 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java
@@ -49,10 +49,16 @@ public class ModulesVMNode extends AbstractDMVMNode
}
}
+
public ModulesVMNode(AbstractDMVMProvider provider, DsfSession session) {
super(provider, session, IModuleDMContext.class);
}
+ @Override
+ public String toString() {
+ return "ModulesVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
@Override
protected void updateElementsInSessionThread(final IChildrenUpdate update) {
IModules modulesService = getServicesTracker().getService(IModules.class);
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterBitFieldVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterBitFieldVMNode.java
index e5aa9c09cc7..6a7f5680501 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterBitFieldVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterBitFieldVMNode.java
@@ -159,6 +159,12 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
fFormattedPrefStore = prefStore;
}
+
+ @Override
+ public String toString() {
+ return "RegisterBitFieldVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public IFormattedValuePreferenceStore getPreferenceStore() {
return fFormattedPrefStore;
}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterGroupVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterGroupVMNode.java
index a09291eea0b..08f15ab6080 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterGroupVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/register/RegisterGroupVMNode.java
@@ -133,7 +133,12 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
super(provider, session, IRegisters.IRegisterGroupDMContext.class);
fSyncRegisterDataAccess = syncDataAccess;
}
-
+
+ @Override
+ public String toString() {
+ return "RegisterGroupVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public SyncRegisterDataAccess getSyncRegisterDataAccess() {
return fSyncRegisterDataAccess;
}
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 7c627b391b7..f8b8a16070e 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
@@ -151,6 +151,11 @@ public class RegisterVMNode extends AbstractExpressionVMNode
fFormattedPrefStore = prefStore;
}
+ @Override
+ public String toString() {
+ return "RegisterVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
protected SyncRegisterDataAccess getSyncRegisterDataAccess() {
return fSyncRegisterDataAccess;
}
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMNode.java
index 1f45940de81..a7ac5cbe217 100644
--- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/variable/VariableVMNode.java
@@ -198,6 +198,11 @@ public class VariableVMNode extends AbstractExpressionVMNode
fSyncVariableDataAccess = syncVariableDataAccess;
}
+ @Override
+ public String toString() {
+ return "VariableVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
@Override
protected IDMVMContext createVMContext(IDMContext dmc) {
return new VariableExpressionVMC(dmc);
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java
index a27ca2bdcac..a3a147e2b02 100644
--- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java
@@ -367,7 +367,7 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
// Optimization: Try to find a delta with a matching element, if found use it.
// Otherwise create a new delta for the event element.
int elementIndex = nodeOffset + i;
- VMDelta delta = (VMDelta)parentDelta.getChildDelta(vmc);
+ VMDelta delta = parentDelta.getChildDelta(vmc);
if (delta == null || delta.getIndex() != elementIndex) {
delta = parentDelta.addNode(vmc, elementIndex, IModelDelta.NO_CHANGE);
}
@@ -385,7 +385,7 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
for (IVMContext vmc : vmcs) {
// Optimization: Try to find a delta with a matching element, if found use it.
// Otherwise create a new delta for the event element.
- VMDelta delta = (VMDelta)parentDelta.getChildDelta(vmc);
+ VMDelta delta = parentDelta.getChildDelta(vmc);
if (delta == null) {
delta = parentDelta.addNode(vmc, IModelDelta.NO_CHANGE);
}
@@ -458,8 +458,10 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
// and then call all the child nodes to build their delta.
for (int i = 0; i < getData().size(); i++) {
int elementIndex = nodeOffset >= 0 ? nodeOffset + i : -1;
- VMDelta delta =
- parentDelta.addNode(getData().get(i), elementIndex, IModelDelta.NO_CHANGE);
+ VMDelta delta= parentDelta.getChildDelta(getData().get(i));
+ if (delta == null) {
+ delta= parentDelta.addNode(getData().get(i), elementIndex, IModelDelta.NO_CHANGE);
+ }
callChildNodesToBuildDelta(
node, childNodesWithDeltaFlags, delta, event,
elementsDeltasMultiRequestMon.add(new RequestMonitor(getVMProvider().getExecutor(), null) {
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/VMDelta.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/VMDelta.java
index a6a30d5044f..bfbc375bf1e 100644
--- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/VMDelta.java
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/VMDelta.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation 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
@@ -195,6 +195,25 @@ public class VMDelta extends ModelDelta {
return node;
}
+ /**
+ * Returns the child delta for the given element, or null
if none.
+ *
+ * @param element child element
+ * @return corresponding delta node, or null
+ */
+ @Override
+ public VMDelta getChildDelta(Object element) {
+ if (fNodes != null) {
+ for (int i = 0; i < fNodes.length; i++) {
+ VMDelta delta = fNodes[i];
+ if (element.equals(delta.getElement())) {
+ return delta;
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Sets the parent delta of this delta
*
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/datamodel/RootDMVMNode.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/datamodel/RootDMVMNode.java
index 75069da2dab..89670968ba3 100644
--- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/datamodel/RootDMVMNode.java
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/datamodel/RootDMVMNode.java
@@ -35,6 +35,12 @@ public class RootDMVMNode extends RootVMNode
super(provider);
}
+
+ @Override
+ public String toString() {
+ return "RootDMVMNode"; //$NON-NLS-1$
+ }
+
/**
* If the input object is a Data Model context, and the event is a DMC event.
* Then we can filter the event to make sure that the view does not
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java
index 8c56cf5e1b8..7d21cbc5b19 100644
--- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java
@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.concurrent.Executor;
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.DsfRunnable;
@@ -79,7 +78,8 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
@Override
public String toString() {
- return fViewerInput + "." + fPath.toString() + "(" + fNode + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return fNode.toString() + " " + //$NON-NLS-1$
+ (fPath.getSegmentCount() == 0 ? fViewerInput.toString() : fPath.getLastSegment().toString());
}
@Override
@@ -183,6 +183,12 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
}
return 0;
}
+
+ @Override
+ public String toString() {
+ return fElementTester.toString() + " " + fRootElement.toString(); //$NON-NLS-1$
+ }
+
}
/**
@@ -197,11 +203,6 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
fRootElement = rootElement;
}
- @Override
- public String toString() {
- return "Root marker for " + fRootElement;
- }
-
@Override
public boolean equals(Object obj) {
return obj instanceof RootElementMarkerKey && ((RootElementMarkerKey)obj).fRootElement.equals(fRootElement);
@@ -211,6 +212,11 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
public int hashCode() {
return fRootElement.hashCode();
}
+
+ @Override
+ public String toString() {
+ return fRootElement.toString();
+ }
}
class RootElementMarkerEntry extends Entry {
@@ -223,6 +229,11 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
super.remove();
rootElementRemovedFromCache(((RootElementMarkerKey)fKey).fRootElement);
}
+
+ @Override
+ public String toString() {
+ return "ROOT MARKER " + fKey; //$NON-NLS-1$
+ }
}
protected static String SELECTED_UPDATE_MODE = "org.eclipse.dd.dsf.ui.viewmodel.update.selectedUpdateMode"; //$NON-NLS-1$
@@ -251,7 +262,12 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
public AbstractCachingVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext) {
super(adapter, presentationContext);
- fCacheListHead = new Entry(null);
+ fCacheListHead = new Entry(null) {
+ @Override
+ public String toString() {
+ return "HEAD"; //$NON-NLS-1$
+ }
+ };
fCacheListHead.fNext = fCacheListHead;
fCacheListHead.fPrevious = fCacheListHead;
@@ -703,10 +719,10 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
ElementDataKey key = makeEntryKey(node, update);
final ElementDataEntry entry = getElementDataEntry(key);
- if (entry.fDirty) {
+ /*if (entry.fDirty) {
rm.setStatus(Status.CANCEL_STATUS);
rm.done();
- } else {
+ } else */{
Object dataOrStatus = entry.fDataOrStatus.get(dmc);
if(dataOrStatus != null) {
if (dataOrStatus instanceof IDMData) {
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AutomaticUpdatePolicy.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AutomaticUpdatePolicy.java
index 9e1a8034263..a3c682994e4 100644
--- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AutomaticUpdatePolicy.java
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AutomaticUpdatePolicy.java
@@ -29,6 +29,11 @@ public class AutomaticUpdatePolicy implements IVMUpdatePolicy {
public boolean includes(IElementUpdateTester tester) {
return tester.equals(this);
}
+
+ @Override
+ public String toString() {
+ return "Autoamtic update tester"; //$NON-NLS-1$
+ }
};
public String getID() {
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ManualUpdatePolicy.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ManualUpdatePolicy.java
index 270b730d75f..732fbd522ef 100644
--- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ManualUpdatePolicy.java
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/ManualUpdatePolicy.java
@@ -49,6 +49,11 @@ public class ManualUpdatePolicy implements IVMUpdatePolicy {
tester instanceof UserEditEventUpdateTester &&
fElements.equals(((UserEditEventUpdateTester)tester).fElements);
}
+
+ @Override
+ public String toString() {
+ return "Edit (" + fElements + ") update tester"; //$NON-NLS-1$
+ }
}
private static IElementUpdateTester fgUpdateTester = new IElementUpdateTester() {
@@ -59,6 +64,11 @@ public class ManualUpdatePolicy implements IVMUpdatePolicy {
public boolean includes(IElementUpdateTester tester) {
return tester.equals(this);
}
+
+ @Override
+ public String toString() {
+ return "Manual (refresh = false) update tester"; //$NON-NLS-1$
+ }
};
private static IElementUpdateTester fgRefreshUpdateTester = new IElementUpdateTester() {
@@ -69,6 +79,11 @@ public class ManualUpdatePolicy implements IVMUpdatePolicy {
public boolean includes(IElementUpdateTester tester) {
return tester.equals(this) || tester.equals(fgUpdateTester) || tester instanceof UserEditEventUpdateTester;
}
+
+ @Override
+ public String toString() {
+ return "Manual (refresh = true) update tester"; //$NON-NLS-1$
+ }
};
public String getID() {
diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/UpdatePolicyDecorator.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/UpdatePolicyDecorator.java
new file mode 100644
index 00000000000..556d2579466
--- /dev/null
+++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/UpdatePolicyDecorator.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 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.dd.dsf.ui.viewmodel.update;
+
+/**
+ * An update policy decorator which can override behaviour of an underlying update policy.
+ */
+public abstract class UpdatePolicyDecorator implements IVMUpdatePolicy {
+
+ private final IVMUpdatePolicy fBasePolicy;
+
+ protected UpdatePolicyDecorator(IVMUpdatePolicy base) {
+ fBasePolicy= base;
+ }
+
+ protected final IVMUpdatePolicy getBaseUpdatePolicy() {
+ return fBasePolicy;
+ }
+
+ public final String getID() {
+ return fBasePolicy.getID();
+ }
+
+ public String getName() {
+ return fBasePolicy.getName();
+ }
+
+ public IElementUpdateTester getElementUpdateTester(Object event) {
+ return fBasePolicy.getElementUpdateTester(event);
+ }
+}
diff --git a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FileVMNode.java b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FileVMNode.java
index 42bfd482267..90fc5326498 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FileVMNode.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FileVMNode.java
@@ -61,6 +61,12 @@ class FileVMNode
fProvider = provider;
}
+ @Override
+ public String toString() {
+ return "FileVMNode";
+ }
+
+
public void dispose() {
// All resources garbage collected.
}
diff --git a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FilesystemRootsVMNode.java b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FilesystemRootsVMNode.java
index e62f62c0e9f..d3a127f586e 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FilesystemRootsVMNode.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/filebrowser/FilesystemRootsVMNode.java
@@ -42,6 +42,11 @@ class FilesystemRootsVMNode extends AbstractVMNode
super(provider);
}
+ @Override
+ public String toString() {
+ return "FilesystemRootsVMNode";
+ }
+
public void update(final IChildrenUpdate[] updates) {
new Job("") { //$NON-NLS-1$
{
diff --git a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/AlarmsVMNode.java b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/AlarmsVMNode.java
index a9fc06b049b..2ab8f19e546 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/AlarmsVMNode.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/AlarmsVMNode.java
@@ -41,6 +41,12 @@ class AlarmsVMNode extends AbstractDMVMNode
super(provider, session, AlarmDMContext.class);
}
+ @Override
+ public String toString() {
+ return "AlarmsVMNode(" + getSession().getId() + ")";
+ }
+
+
@Override
protected void updateElementsInSessionThread(final IChildrenUpdate update) {
// Check that the service is available and find the trigger and timer contexts.
diff --git a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TimersVMNode.java b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TimersVMNode.java
index b7c22da40b4..fd3f3767731 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TimersVMNode.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TimersVMNode.java
@@ -78,6 +78,11 @@ class TimersVMNode extends AbstractDMVMNode
super(provider, session, TimerDMContext.class);
}
+ @Override
+ public String toString() {
+ return "TimersVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public void update(ILabelUpdate[] updates) {
fgLabelProvider.update(updates);
}
diff --git a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TriggersVMNode.java b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TriggersVMNode.java
index 0a0fd8ece43..4daa2e9e620 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TriggersVMNode.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src/org/eclipse/dd/examples/dsf/timers/TriggersVMNode.java
@@ -83,6 +83,11 @@ class TriggersVMNode extends AbstractDMVMNode
super(provider, session, TriggerDMContext.class);
}
+ @Override
+ public String toString() {
+ return "TriggersVMNode(" + getSession().getId() + ")";
+ }
+
@Override
protected void updateElementsInSessionThread(final IChildrenUpdate update) {
AlarmService alarmService = getServicesTracker().getService(AlarmService.class, null);
diff --git a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java
index 881fa6706ae..3315c57a7db 100644
--- a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java
+++ b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
+import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory;
import org.eclipse.dd.dsf.debug.ui.actions.DsfResumeCommand;
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepIntoCommand;
import org.eclipse.dd.dsf.debug.ui.actions.DsfStepOverCommand;
@@ -42,6 +43,7 @@ import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
/**
@@ -82,6 +84,8 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
final IDebugModelProvider fDebugModelProvider;
final PDALaunch fLaunch;
+ private IModelSelectionPolicyFactory fModelSelectionPolicyFactory;
+
LaunchAdapterSet(PDALaunch launch) {
// Initialize launch and session.
fLaunch = launch;
@@ -93,6 +97,10 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
// Initialize source lookup
fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator());
session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
+
+ // Default selection policy
+ fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory();
+ session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory);
// Initialize retargetable command handler.
fStepIntoCommand = new DsfStepIntoCommand(session, null);
@@ -130,6 +138,8 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
session.unregisterModelAdapter(ISourceDisplay.class);
if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
+ session.unregisterModelAdapter(IModelSelectionPolicyFactory.class);
+
session.unregisterModelAdapter(IStepIntoHandler.class);
session.unregisterModelAdapter(IStepOverHandler.class);
session.unregisterModelAdapter(IStepReturnHandler.class);
diff --git a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAThreadsVMNode.java b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
index d1d1750c858..5c556bfee12 100644
--- a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
+++ b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
@@ -44,6 +44,10 @@ public class PDAThreadsVMNode extends AbstractThreadVMNode
super(provider, session);
}
+ @Override
+ public String toString() {
+ return "PDAThreadVMNode(" + getSession().getId() + ")";
+ }
@Override
protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
@@ -65,44 +69,47 @@ public class PDAThreadsVMNode extends AbstractThreadVMNode
update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
// Find the Reason for the State
- runControl.getExecutionData(dmc,
- new ViewerDataRequestMonitor(getSession().getExecutor(), update) {
- @Override
- public void handleCompleted(){
- if (!isSuccess()) {
- handleFailedUpdate(update);
- return;
- }
+ 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();
- }
- });
+ // 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());
}
}
diff --git a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
index 4a31e8e2acc..8df1dfd8e72 100644
--- a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
+++ b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
@@ -46,12 +46,16 @@ import org.eclipse.ui.IMemento;
public class PDAVirtualMachineVMNode extends AbstractContainerVMNode
implements IElementMementoProvider
{
-
-
public PDAVirtualMachineVMNode(AbstractDMVMProvider provider, DsfSession session) {
super(provider, session);
}
+ @Override
+ public String toString() {
+ return "PDAContainerVMNode(" + getSession().getId() + ")";
+ }
+
+
@Override
protected void updateElementsInSessionThread(IChildrenUpdate update) {
// Get the instance of the service. Note that there is no race condition
@@ -97,8 +101,8 @@ public class PDAVirtualMachineVMNode extends AbstractContainerVMNode
update.setImageDescriptor(DebugUITools.getImageDescriptor(imageKey), 0);
// Retrieve the last state change reason
- runControl.getExecutionData(
- programCtx,
+ getDMVMProvider().getModelData(
+ this, update, runControl, programCtx,
new ViewerDataRequestMonitor(ImmediateExecutor.getInstance(), update)
{
@Override
@@ -130,31 +134,10 @@ public class PDAVirtualMachineVMNode extends AbstractContainerVMNode
update.setLabel(builder.toString(), 0);
update.done();
}
- });
+ },
+ getExecutor());
}
-/* @Override
- public int getDeltaFlags(Object e) {
- if (e instanceof PDAStartedEvent) {
- return IModelDelta.EXPAND | IModelDelta.SELECT;
- }
- return super.getDeltaFlags(e);
- }
-
- @Override
- public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) {
- if (e instanceof PDAStartedEvent) {
- // When debug session is started expand and select the program.
- // If the program hits a breakpoint, the top stack frame will then
- // be selected.
- parentDelta.addNode(createVMContext(((PDAStartedEvent)e).getDMContext()), IModelDelta.EXPAND | IModelDelta.SELECT);
- rm.done();
- } else {
- super.buildDelta(e, parentDelta, nodeOffset, rm);
- }
- }
-*/
-
private String produceProgramElementName( String viewName , PDAVirtualMachineDMContext execCtx ) {
return "PDA." + execCtx.getProgram(); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.dd.examples.pda/src/org/eclipse/dd/examples/pda/service/PDACommandControl.java b/plugins/org.eclipse.dd.examples.pda/src/org/eclipse/dd/examples/pda/service/PDACommandControl.java
index b4121dc4799..35a3060170a 100644
--- a/plugins/org.eclipse.dd.examples.pda/src/org/eclipse/dd/examples/pda/service/PDACommandControl.java
+++ b/plugins/org.eclipse.dd.examples.pda/src/org/eclipse/dd/examples/pda/service/PDACommandControl.java
@@ -31,6 +31,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
+import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
import org.eclipse.dd.dsf.debug.service.command.ICommand;
@@ -416,14 +417,26 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
// Trace to debug output.
PDAPlugin.debug("R: " + response);
- // Given the PDA response string, create the result using the command
- // that was sent.
- PDACommandResult result = handle.fCommand.createResult(response);
+ PDACommandResult result = null;
- // Set the result to the request monitor and return to sender.
- // Note: as long as PDA sends some response, a PDA command will never
- // return an error.
- handle.fRequestMonitor.setData(result);
+ if (response.startsWith("error:")) {
+ // Create a generic result with the error response
+ result = new PDACommandResult(response);
+
+ // Set the error status to the request monitor.
+ handle.fRequestMonitor.setStatus(new Status(
+ IStatus.ERROR, PDAPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED, response, null));
+ } else {
+ // Given the PDA response string, create the result using the command
+ // that was sent.
+ result = handle.fCommand.createResult(response);
+
+ // Set the result to the request monitor and return to sender.
+ // Note: as long as PDA sends some response, a PDA command will never
+ // return an error.
+ handle.fRequestMonitor.setData(result);
+ }
handle.fRequestMonitor.done();
// Notify listeners of the response
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
index 087f2515c77..fcc21969291 100644
--- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
@@ -45,11 +45,14 @@ import org.eclipse.ui.IMemento;
public class ContainerVMNode extends AbstractContainerVMNode
implements IElementMementoProvider
{
-
-
public ContainerVMNode(AbstractDMVMProvider provider, DsfSession session) {
super(provider, session);
}
+
+ @Override
+ public String toString() {
+ return "ContainerVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
@Override
protected void updateElementsInSessionThread(IChildrenUpdate update) {
diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
index 8768c491693..d717ab24128 100644
--- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
+++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
@@ -41,6 +41,10 @@ public class ThreadVMNode extends AbstractThreadVMNode
super(provider, session);
}
+ @Override
+ public String toString() {
+ return "ThreadVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
@Override
protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
@@ -67,7 +71,8 @@ public class ThreadVMNode extends AbstractThreadVMNode
@Override
public void handleCompleted(){
if (!isSuccess()) {
- handleFailedUpdate(update);
+ update.setLabel("", 0); //$NON-NLS-1$
+ update.done();
return;
}