From c50257d07df16e3c4ff0f97e969775a6c6a97fb9 Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Thu, 27 Mar 2008 22:09:11 +0000 Subject: [PATCH] [224434] Changed the context used in IRunControl.IStartedDMEvent and IRunControl.IExitedDMEvent events. --- .../sourcelookup/DsfSourceDisplayAdapter.java | 10 ++--- .../dd/dsf/debug/service/IRunControl.java | 14 ++----- .../ui/viewmodel/launch/ContainerVMNode.java | 9 +++- .../eclipse/dd/mi/service/MIRunControl.java | 41 ++++++------------- .../dd/tests/gdb/MIRunControlTest.java | 2 +- 5 files changed, 30 insertions(+), 46 deletions(-) diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java index 7e3e9e63e68..d8e66e186ad 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java @@ -502,10 +502,10 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay } private void startAnnotationClearingJob(IRunControl.IExecutionDMContext execDmc) { - // Make sure to add the dmc to the list. + // Make sure to add the context to the list. fPendingExecDmcsToClear.add(execDmc); - // If lookup job is running, check it agains the exec context, + // If lookup job is running, check it against the execution context, // and cancel it if matches. if (fRunningLookupJob != null) { if (DMContexts.isAncestorOf(fRunningLookupJob.getDmc(), execDmc)) { @@ -513,8 +513,8 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay fRunningLookupJob = null; } } - // If there is a pending displahy job, make sure it doesn't get - // pre-empted by this event. If so, just cancel the pending + // If there is a pending display job, make sure it doesn't get + // preempted by this event. If so, just cancel the pending // display job. if (fPendingDisplayJob != null) { if (DMContexts.isAncestorOf(fPendingDisplayJob.getDmc(), execDmc)) { @@ -539,7 +539,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay @DsfServiceEventHandler public void eventDispatched(IRunControl.IExitedDMEvent e) { - startAnnotationClearingJob(e.getExecutionContext()); + startAnnotationClearingJob(e.getDMContext()); } @DsfServiceEventHandler diff --git a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRunControl.java b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRunControl.java index b5b0d4a3421..3bbc4242275 100644 --- a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRunControl.java +++ b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRunControl.java @@ -83,20 +83,14 @@ public interface IRunControl extends IDMService } /** - * Indicates that a new execution context (thread) was started. The DMC - * for the event is the container of the new exec context. + * Indicates that a new execution context (thread) was started. */ - public interface IStartedDMEvent extends IDMEvent { - IExecutionDMContext getExecutionContext(); - } + public interface IStartedDMEvent extends IDMEvent {} /** - * Indicates that an execution context has exited. As in the started event, - * the DMC for the event is the container of the exec context. + * Indicates that an execution context has exited. */ - public interface IExitedDMEvent extends IDMEvent { - IExecutionDMContext getExecutionContext(); - } + public interface IExitedDMEvent extends IDMEvent {} /** * Display information for an execution context. 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 f0f3542e170..7e970636371 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 @@ -17,8 +17,10 @@ import java.util.concurrent.RejectedExecutionException; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DsfRunnable; import org.eclipse.dd.dsf.concurrent.RequestMonitor; +import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.debug.service.IRunControl; +import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent; import org.eclipse.dd.dsf.debug.service.IRunControl.IStartedDMEvent; import org.eclipse.dd.dsf.service.DsfSession; @@ -124,13 +126,16 @@ public class ContainerVMNode extends AbstractDMVMNode } public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) { - if(e instanceof IRunControl.IContainerResumedDMEvent || e instanceof IRunControl.IContainerSuspendedDMEvent) { parentDelta.addNode(createVMContext(((IDMEvent)e).getDMContext()), IModelDelta.CONTENT); } else if (e instanceof IStartedDMEvent || e instanceof IExitedDMEvent) { - parentDelta.addNode(createVMContext(((IDMEvent)e).getDMContext()), IModelDelta.CONTENT); + IContainerDMContext containerCtx = DMContexts.getAncestorOfType( + ((IDMEvent)e).getDMContext(), IContainerDMContext.class); + if (containerCtx != null) { + parentDelta.addNode(createVMContext(containerCtx), IModelDelta.CONTENT); + } } else if (e instanceof GDBControl.ExitedEvent || e instanceof MIInferiorExitEvent || e instanceof MIInferiorSignalExitEvent) diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java index 5316ebcc231..c0879ffed74 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControl.java @@ -236,35 +236,20 @@ public class MIRunControl extends AbstractDsfService implements IRunControl } @Immutable - protected static class StartedDMEvent extends RunControlEvent - implements IStartedDMEvent{ - - private final IMIExecutionDMContext fExecutionDmc; - - StartedDMEvent(IContainerDMContext containerDmc, IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) { - super(containerDmc, miInfo); - fExecutionDmc = executionDmc; + protected static class StartedDMEvent extends RunControlEvent + implements IStartedDMEvent + { + StartedDMEvent(IMIExecutionDMContext executionDmc, MIThreadCreatedEvent miInfo) { + super(executionDmc, miInfo); } - - public IExecutionDMContext getExecutionContext(){ - return fExecutionDmc; - } - } @Immutable - protected static class ExitedDMEvent extends RunControlEvent - implements IExitedDMEvent{ - - private final IMIExecutionDMContext fExecutionDmc; - - ExitedDMEvent(IContainerDMContext containerDmc, IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) { - super(containerDmc, miInfo); - fExecutionDmc = executionDmc; - } - - public IExecutionDMContext getExecutionContext(){ - return fExecutionDmc; + protected static class ExitedDMEvent extends RunControlEvent + implements IExitedDMEvent + { + ExitedDMEvent(IMIExecutionDMContext executionDmc, MIThreadExitEvent miInfo) { + super(executionDmc, miInfo); } } @@ -375,7 +360,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl public void eventDispatched(final MIThreadCreatedEvent e) { IContainerDMContext containerDmc = e.getDMContext(); IMIExecutionDMContext executionCtx = e.getId() != -1 ? new MIExecutionDMC(getSession().getId(), containerDmc, e.getId()) : null; - getSession().dispatchEvent(new StartedDMEvent(containerDmc, executionCtx, e), getProperties()); + getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties()); } // @@ -386,7 +371,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl public void eventDispatched(final MIThreadExitEvent e) { IContainerDMContext containerDmc = e.getDMContext(); IMIExecutionDMContext executionCtx = e.getId() != -1 ? new MIExecutionDMC(getSession().getId(), containerDmc, e.getId()) : null; - getSession().dispatchEvent(new ExitedDMEvent(containerDmc, executionCtx, e), getProperties()); + getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties()); } @DsfServiceEventHandler @@ -430,7 +415,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl // Event handler when a thread is destroyed @DsfServiceEventHandler public void eventDispatched(ExitedDMEvent e) { - fMICommandCache.reset(e.getExecutionContext()); + fMICommandCache.reset(e.getDMContext()); } /////////////////////////////////////////////////////////////////////////// diff --git a/plugins/org.eclipse.dd.tests.gdb/src/org/eclipse/dd/tests/gdb/MIRunControlTest.java b/plugins/org.eclipse.dd.tests.gdb/src/org/eclipse/dd/tests/gdb/MIRunControlTest.java index 92df99a53bd..e42ae5da1f9 100644 --- a/plugins/org.eclipse.dd.tests.gdb/src/org/eclipse/dd/tests/gdb/MIRunControlTest.java +++ b/plugins/org.eclipse.dd.tests.gdb/src/org/eclipse/dd/tests/gdb/MIRunControlTest.java @@ -438,7 +438,7 @@ public class MIRunControlTest extends BaseTestCase { @DsfServiceEventHandler public void eventDispatched(IStartedDMEvent e) { if(fIsTestingThreadCreateEvent){ - if(((IMIExecutionDMContext)e.getExecutionContext()).getThreadId() != 2) + if(((IMIExecutionDMContext)e.getDMContext()).getThreadId() != 2) /* * Set variable if thread create event is unsuccesful */