1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

[202649] - [update policy][debug view] Add manual refresh mode for thread list in debug view.

This commit is contained in:
Pawel Piech 2008-06-17 20:46:30 +00:00
parent 884e607aab
commit 1e0365550e
33 changed files with 467 additions and 135 deletions

View file

@ -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

View file

@ -319,6 +319,41 @@
</action>
</viewContribution>
<!-- Debug View menu contributions -->
<viewContribution
id="org.eclipse.dd.dsf.debug.ui.viewmodel.update.debugView.Refresh"
targetID="org.eclipse.debug.ui.DebugView">
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.RefreshActionDelegate"
icon="icons/refresh.gif"
id="org.eclipse.dd.dsf.debug.ui.viewmodel.update.actions.Refresh"
label="%action.refresh.label"
toolbarPath="additions">
</action>
<menu id="updatePolicy"
label="%menu.threadsUpdatePolicy"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.ManualUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual"
label="%action.manualUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AutomaticUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic"
label="%action.automaticUpdatePolicy.label"
menubarPath="updatePolicy/additions"
state="true"
style="radio">
</action>
</viewContribution>
</extension>
<extension

View file

@ -138,6 +138,11 @@ public class ExpressionManagerVMNode extends AbstractVMNode
super(provider);
}
@Override
public String toString() {
return "ExpressionManagerVMNode"; //$NON-NLS-1$
}
private ExpressionVMProvider getExpressionVMProvider() {
return (ExpressionVMProvider)getVMProvider();
}

View file

@ -32,7 +32,9 @@ import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter;
import org.eclipse.dd.dsf.ui.viewmodel.IRootVMNode;
import org.eclipse.dd.dsf.ui.viewmodel.IVMModelProxy;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.AutomaticUpdatePolicy;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
import org.eclipse.dd.dsf.ui.viewmodel.update.ManualUpdatePolicy;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
@ -63,7 +65,10 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
@Override
protected IVMUpdatePolicy[] createUpdateModes() {
return new IVMUpdatePolicy[] { new DelayedStackRefreshUpdatePolicy() };
return new IVMUpdatePolicy[] {
new DelayedStackRefreshUpdatePolicy(new AutomaticUpdatePolicy()),
new DelayedStackRefreshUpdatePolicy(new ManualUpdatePolicy())
};
}
public void handleDebugEvents(final DebugEvent[] events) {

View file

@ -259,8 +259,8 @@ public abstract class AbstractThreadVMNode extends AbstractDMVMNode
// ISteppingTimedOutEvent will trigger a refresh.
if (((IResumedDMEvent)e).getReason() != IRunControl.StateChangeReason.STEP) {
parentDelta.addNode(createVMContext(dmc), IModelDelta.CONTENT);
rm.done();
}
rm.done();
} else if (e instanceof ISuspendedDMEvent) {
// Container suspended. Do nothing here to give the stack the
// priority in updating. The thread will update as a result of

View file

@ -11,42 +11,54 @@
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent;
import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.update.AutomaticUpdatePolicy;
import org.eclipse.dd.dsf.ui.viewmodel.update.IElementUpdateTester;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
import org.eclipse.dd.dsf.ui.viewmodel.update.UpdatePolicyDecorator;
import org.eclipse.jface.viewers.TreePath;
/**
* Automatic update strategy specialized for delayed full stack frame updates. The
* strategy can operate in lazy mode where only the top stack frame is
* invalidated, while in non-lazy mode everything is invalidated.
* An update strategy decorator specialized for delayed stack frame refresh. The
* strategy flushes only the cached top stack frame in case of an normal {@link ISuspendedDMEvent},
* while in in case of a special {@link FullStackRefreshEvent} everything is invalidated.
*
* <p>
* The underlying base update policy is considered for container contexts only.
* </p>
*/
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$
}
}

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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)

View file

@ -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());

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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) {

View file

@ -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 <code>null</code> if none.
*
* @param element child element
* @return corresponding delta node, or <code>null</code>
*/
@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
*

View file

@ -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

View file

@ -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) {

View file

@ -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() {

View file

@ -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() {

View file

@ -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);
}
}

View file

@ -61,6 +61,12 @@ class FileVMNode
fProvider = provider;
}
@Override
public String toString() {
return "FileVMNode";
}
public void dispose() {
// All resources garbage collected.
}

View file

@ -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$
{

View file

@ -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.

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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<IExecutionDMData>(getSession().getExecutor(), update) {
@Override
public void handleCompleted(){
if (!isSuccess()) {
handleFailedUpdate(update);
return;
}
getDMVMProvider().getModelData(
this, update, runControl, dmc,
new ViewerDataRequestMonitor<IExecutionDMData>(getSession().getExecutor(), update) {
@Override
public void handleCompleted(){
if (!isSuccess()) {
update.setLabel("<unavailable>", 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());
}
}

View file

@ -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<IExecutionDMData>(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$
}

View file

@ -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

View file

@ -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) {

View file

@ -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("<unavailable>", 0); //$NON-NLS-1$
update.done();
return;
}