From 1fbfd51facb2701b4440e664ab726052534c8e7e Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Fri, 8 Aug 2008 17:42:23 +0000 Subject: [PATCH] [243611] - [commands] Add an ICommandControlService interface. --- .../service/command/ICommandControl.java | 5 +- .../command/ICommandControlService.java | 67 +++++++++++++++++++ .../ui/viewmodel/launch/ContainerVMNode.java | 12 ++-- .../ui/viewmodel/launch/LaunchVMProvider.java | 8 +-- .../provisional/launching/GdbLaunch.java | 4 +- .../service/command/GDBControl.java | 40 +++++++++-- .../eclipse/dd/mi/service/MIBreakpoints.java | 6 +- .../dd/mi/service/MIBreakpointsManager.java | 6 +- .../eclipse/dd/mi/service/MIRunControl.java | 6 +- .../eclipse/dd/mi/service/MIRunControlNS.java | 4 +- .../mi/service/command/AbstractMIControl.java | 41 +++++------- .../service/command/MIControlDMContext.java | 14 ++-- .../command/events/MIGDBExitEvent.java | 4 ++ 13 files changed, 158 insertions(+), 59 deletions(-) create mode 100644 plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControlService.java diff --git a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControl.java b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControl.java index ba635f90a53..04d1e0e15bd 100644 --- a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControl.java +++ b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControl.java @@ -14,7 +14,10 @@ import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; /** * API for sending commands to the debugger and for receiving command results - * and asynchronous events. + * and asynchronous events. The command control may be implemented by a service + * or a non-service object. + * + * @see ICommandControlService */ public interface ICommandControl { diff --git a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControlService.java b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControlService.java new file mode 100644 index 00000000000..9fc087c54ee --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/command/ICommandControlService.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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.service.command; + +import org.eclipse.dd.dsf.datamodel.IDMContext; +import org.eclipse.dd.dsf.datamodel.IDMEvent; +import org.eclipse.dd.dsf.service.IDsfService; + +/** + * Service which acts as a command control. + * + * @since 1.1 + */ +public interface ICommandControlService extends ICommandControl, IDsfService { + + /** + * Context representing a command control service. All contexts which + * originate from a given command control service, should have that + * control's context in their hierarchy. + * + * @see ICommandControlService#getContext() + */ + public interface ICommandControlDMContext extends IDMContext { + /** + * Returns the ID of the command control that this context + * represents. + */ + public String getCommandControlId(); + } + + /** + * Event indicating that the back end process has started. + */ + public interface ICommandControlInitializedDMEvent extends IDMEvent {}; + + /** + * Event indicating that the back end process has terminated. + */ + public interface ICommandControlShutdownDMEvent extends IDMEvent {}; + + /** + * Returns the identifier of this command control service. It can be used + * to distinguish between multiple instances of command control services. + */ + public String getId(); + + /** + * returns the context representing this command control. + */ + public ICommandControlDMContext getContext(); + + /** + * Returns whether this command control is currently active. A command + * control service is active if it has been initialized and has not yet + * shut down. + * @return + */ + public boolean isActive(); +} 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 77220ecfc2b..b9f049c28fa 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 @@ -25,14 +25,14 @@ import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMData; import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlInitializedDMEvent; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.concurrent.ViewerDataRequestMonitor; import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendStartedEvent; 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; @@ -127,9 +127,9 @@ public class ContainerVMNode extends AbstractContainerVMNode @Override public int getDeltaFlags(Object e) { - if (e instanceof BackendExitedEvent) { + if (e instanceof ICommandControlShutdownDMEvent) { return IModelDelta.CONTENT; - } else if (e instanceof BackendStartedEvent) { + } else if (e instanceof ICommandControlInitializedDMEvent) { return IModelDelta.EXPAND; } return super.getDeltaFlags(e); @@ -137,9 +137,9 @@ public class ContainerVMNode extends AbstractContainerVMNode @Override public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) { - if (e instanceof BackendExitedEvent) { + if (e instanceof ICommandControlShutdownDMEvent) { parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT); - } else if (e instanceof BackendStartedEvent) { + } else if (e instanceof ICommandControlInitializedDMEvent) { parentDelta.addNode(createVMContext(((IDMEvent)e).getDMContext()), IModelDelta.EXPAND); } else { super.buildDelta(e, parentDelta, nodeOffset, requestMonitor); diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java index 567ca219394..e89b3b7878f 100644 --- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java @@ -16,12 +16,12 @@ import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.Abstrac import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.LaunchRootVMNode; import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.StackFramesVMNode; import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.StandardProcessVMNode; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlInitializedDMEvent; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMAdapter; import org.eclipse.dd.dsf.ui.viewmodel.IRootVMNode; import org.eclipse.dd.dsf.ui.viewmodel.IVMNode; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendStartedEvent; import org.eclipse.dd.mi.service.command.MIInferiorProcess.InferiorExitedDMEvent; import org.eclipse.dd.mi.service.command.MIInferiorProcess.InferiorStartedDMEvent; import org.eclipse.debug.core.DebugPlugin; @@ -75,8 +75,8 @@ public class LaunchVMProvider extends AbstractLaunchVMProvider // Never skip the process lifecycle events. if (eventToSkip instanceof InferiorExitedDMEvent || eventToSkip instanceof InferiorStartedDMEvent || - eventToSkip instanceof BackendStartedEvent || - eventToSkip instanceof BackendExitedEvent) + eventToSkip instanceof ICommandControlInitializedDMEvent || + eventToSkip instanceof ICommandControlShutdownDMEvent) { return false; } diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunch.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunch.java index 3dde0449dae..bd90c89d448 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunch.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/GdbLaunch.java @@ -32,6 +32,7 @@ import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor; import org.eclipse.dd.dsf.debug.model.DsfMemoryBlockRetrieval; import org.eclipse.dd.dsf.debug.service.IDsfDebugServicesFactory; import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryDMContext; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfSession; @@ -39,7 +40,6 @@ import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.mi.service.command.AbstractCLIProcess; import org.eclipse.dd.mi.service.command.MIInferiorProcess; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; @@ -185,7 +185,7 @@ public class GdbLaunch extends Launch /////////////////////////////////////////////////////////////////////////// // IServiceEventListener - @DsfServiceEventHandler public void eventDispatched(BackendExitedEvent event) { + @DsfServiceEventHandler public void eventDispatched(ICommandControlShutdownDMEvent event) { shutdownSession(new RequestMonitor(ImmediateExecutor.getInstance(), null)); } diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java index f691b76ed0a..e67a23adf49 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java @@ -38,6 +38,7 @@ 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.Sequence; +import org.eclipse.dd.dsf.datamodel.AbstractDMEvent; import org.eclipse.dd.dsf.debug.service.command.ICommandControl; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfSession; @@ -72,6 +73,27 @@ import org.osgi.framework.BundleContext; */ public class GDBControl extends AbstractMIControl { + /** + * Event indicating that the back end process has started. + */ + public static class GDBControlInitializedDMEvent extends AbstractDMEvent + implements ICommandControlInitializedDMEvent + { + public GDBControlInitializedDMEvent(GDBControlDMContext context) { + super(context); + } + } + + /** + * Event indicating that the back end process has terminated. + */ + public static class GDBControlShutdownDMEvent extends AbstractDMEvent + implements ICommandControlShutdownDMEvent + { + public GDBControlShutdownDMEvent(GDBControlDMContext context) { + super(context); + } + } private static int fgInstanceCounter = 0; private final GDBControlDMContext fControlDmc; @@ -98,7 +120,7 @@ public class GDBControl extends AbstractMIControl { private PTY fPty; public GDBControl(DsfSession session, ILaunchConfiguration config) { - super(session); + super(session, "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ fSessionType = LaunchUtils.getSessionType(config); fAttach = LaunchUtils.getIsAttach(config); fGdbPath = LaunchUtils.getGDBPath(config); @@ -107,18 +129,18 @@ public class GDBControl extends AbstractMIControl { } catch (CoreException e) { fExecPath = new Path(""); //$NON-NLS-1$ } - fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + fControlDmc = new GDBControlDMContext(session.getId(), getId()); } @Deprecated public GDBControl(DsfSession session, IPath gdbPath, IPath execPath, SessionType sessionType, boolean attach, int gdbLaunchTimeout) { - super(session); + super(session, "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ fSessionType = sessionType; fAttach = attach; fGdbPath = gdbPath; fExecPath = execPath; fGDBLaunchTimeout = gdbLaunchTimeout; - fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + fControlDmc = new GDBControlDMContext(session.getId(), getId()); } @Override @@ -174,6 +196,10 @@ public class GDBControl extends AbstractMIControl { return fControlDmc; } + public ICommandControlDMContext getContext() { + return fControlDmc; + } + /** * More strongly typed version of {@link #getControlDMContext()}. */ @@ -418,7 +444,7 @@ public class GDBControl extends AbstractMIControl { } @DsfServiceEventHandler - public void eventDispatched(BackendExitedEvent e) { + public void eventDispatched(ICommandControlShutdownDMEvent e) { // Handle our "GDB Exited" event and stop processing commands. stopCommandProcessing(); } @@ -445,7 +471,7 @@ public class GDBControl extends AbstractMIControl { Thread.interrupted(); } finally { fExited = true; - getSession().dispatchEvent(new BackendExitedEvent(fControlDmc) {}, getProperties()); + getSession().dispatchEvent(new GDBControlShutdownDMEvent(fControlDmc) {}, getProperties()); } } } @@ -717,7 +743,7 @@ public class GDBControl extends AbstractMIControl { public void initialize(final RequestMonitor requestMonitor) { getSession().addServiceEventListener(GDBControl.this, null); register(new String[]{ ICommandControl.class.getName(), AbstractMIControl.class.getName() }, new Hashtable()); - getSession().dispatchEvent(new BackendStartedEvent(getGDBDMContext()), getProperties()); + getSession().dispatchEvent(new GDBControlInitializedDMEvent(getGDBDMContext()), getProperties()); requestMonitor.done(); } diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpoints.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpoints.java index 0d09f97282a..e0a7f736195 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpoints.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpoints.java @@ -27,11 +27,11 @@ import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.debug.service.IBreakpoints; import org.eclipse.dd.dsf.debug.service.command.ICommandControl; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.dd.dsf.service.AbstractDsfService; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.mi.internal.MIPlugin; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; import org.eclipse.dd.mi.service.command.commands.MIBreakAfter; import org.eclipse.dd.mi.service.command.commands.MIBreakCondition; import org.eclipse.dd.mi.service.command.commands.MIBreakDelete; @@ -271,13 +271,13 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints } } - // Not used, kept for API compatibility. BackendExitedEvent is used instead + // Not used, kept for API compatibility. ICommandControlShutdownDMEvent is used instead @DsfServiceEventHandler public void eventDispatched(MIGDBExitEvent e) { } @DsfServiceEventHandler - public void eventDispatched(BackendExitedEvent e) { + public void eventDispatched(ICommandControlShutdownDMEvent e) { } /////////////////////////////////////////////////////////////////////////// diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpointsManager.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpointsManager.java index 7b33df729bd..1cae899564d 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpointsManager.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIBreakpointsManager.java @@ -63,6 +63,7 @@ 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.ISourceLookup.ISourceLookupDMContext; import org.eclipse.dd.dsf.debug.service.command.ICommandControl; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.dd.dsf.service.AbstractDsfService; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfSession; @@ -72,7 +73,6 @@ import org.eclipse.dd.mi.service.MIBreakpoints.BreakpointRemovedEvent; import org.eclipse.dd.mi.service.MIBreakpoints.BreakpointUpdatedEvent; import org.eclipse.dd.mi.service.MIBreakpoints.MIBreakpointDMContext; import org.eclipse.dd.mi.service.breakpoint.actions.BreakpointActionAdapter; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.dd.mi.service.command.events.MIGDBExitEvent; import org.eclipse.dd.mi.service.command.events.MIWatchpointScopeEvent; @@ -1228,14 +1228,14 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // Session exit //------------------------------------------------------------------------- - // Not used, kept for API compatibility. BackendExitedEvent is used instead + // Not used, kept for API compatibility. ICommandControlShutdownDMEvent is used instead @DsfServiceEventHandler public void eventDispatched(MIGDBExitEvent e) { terminated(); } @DsfServiceEventHandler - public void eventDispatched(BackendExitedEvent e) { + public void eventDispatched(ICommandControlShutdownDMEvent e) { terminated(); } 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 98fca089bc4..a8140ae0096 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 @@ -24,12 +24,12 @@ import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.dd.dsf.debug.service.command.CommandCache; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.dd.dsf.service.AbstractDsfService; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.mi.internal.MIPlugin; import org.eclipse.dd.mi.service.command.AbstractMIControl; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; import org.eclipse.dd.mi.service.command.commands.MIExecContinue; import org.eclipse.dd.mi.service.command.commands.MIExecFinish; import org.eclipse.dd.mi.service.command.commands.MIExecInterrupt; @@ -404,14 +404,14 @@ public class MIRunControl extends AbstractDsfService implements IRunControl fStepping = false; } - // Not used, kept for API compatibility. BackendExitedEvent is used instead + // Not used, kept for API compatibility. ICommandControlShutdownDMEvent is used instead @DsfServiceEventHandler public void eventDispatched(MIGDBExitEvent e) { fTerminated = true; } @DsfServiceEventHandler - public void eventDispatched(BackendExitedEvent e) { + public void eventDispatched(ICommandControlShutdownDMEvent e) { fTerminated = true; } diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java index a3cb95620e7..e1d426bf9d7 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/MIRunControlNS.java @@ -30,12 +30,12 @@ import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext; import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.dd.dsf.debug.service.command.CommandCache; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.dd.dsf.service.AbstractDsfService; import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.mi.internal.MIPlugin; import org.eclipse.dd.mi.service.command.AbstractMIControl; -import org.eclipse.dd.mi.service.command.AbstractMIControl.BackendExitedEvent; import org.eclipse.dd.mi.service.command.commands.MIExecContinue; import org.eclipse.dd.mi.service.command.commands.MIExecFinish; import org.eclipse.dd.mi.service.command.commands.MIExecInterrupt; @@ -781,7 +781,7 @@ public class MIRunControlNS extends AbstractDsfService implements IRunControl } @DsfServiceEventHandler - public void eventDispatched(BackendExitedEvent e) { + public void eventDispatched(ICommandControlShutdownDMEvent e) { fTerminated = true; } diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractMIControl.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractMIControl.java index 510f97ca772..bc5830e23ed 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractMIControl.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/AbstractMIControl.java @@ -30,13 +30,12 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DsfRunnable; -import org.eclipse.dd.dsf.datamodel.AbstractDMEvent; import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.dd.dsf.debug.service.command.ICommand; -import org.eclipse.dd.dsf.debug.service.command.ICommandControl; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService; import org.eclipse.dd.dsf.debug.service.command.ICommandListener; import org.eclipse.dd.dsf.debug.service.command.ICommandResult; import org.eclipse.dd.dsf.debug.service.command.ICommandToken; @@ -65,28 +64,10 @@ import org.eclipse.dd.mi.service.command.output.MIValue; * Extending classes need to implement the initialize() and shutdown() methods. */ public abstract class AbstractMIControl extends AbstractDsfService - implements ICommandControl + implements ICommandControlService { final static String PROP_INSTANCE_ID = MIPlugin.PLUGIN_ID + ".miControlInstanceId"; //$NON-NLS-1$ - /** - * Event indicating that the back end process has started. - */ - public static class BackendStartedEvent extends AbstractDMEvent { - public BackendStartedEvent(MIControlDMContext context) { - super(context); - } - } - - /** - * Event indicating that the back end process has terminated. - */ - public static class BackendExitedEvent extends AbstractDMEvent { - public BackendExitedEvent(MIControlDMContext context) { - super(context); - } - } - /* * Thread control variables for the transmit and receive threads. */ @@ -126,12 +107,16 @@ public abstract class AbstractMIControl extends AbstractDsfService */ private boolean fStoppedCommandProcessing = false; - /* - * Public constructor. - */ + private String fId; public AbstractMIControl(DsfSession session) { super(session); + fId = ""; //$NON-NLS-1$ + } + + public AbstractMIControl(DsfSession session, String id) { + super(session); + fId = id; } /** @@ -363,6 +348,14 @@ public abstract class AbstractMIControl extends AbstractDsfService abstract public MIControlDMContext getControlDMContext(); + public boolean isActive() { + return !fStoppedCommandProcessing; + } + + public String getId() { + return fId; + } + /* * These are the service routines which perform the various callouts back to the listeners. */ diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIControlDMContext.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIControlDMContext.java index 371a4efaa58..ad191e097c9 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIControlDMContext.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/MIControlDMContext.java @@ -14,14 +14,16 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMContext; import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.debug.service.command.ICommandControl; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; import org.eclipse.dd.dsf.service.IDsfService; import org.osgi.framework.Constants; /** * */ -public class MIControlDMContext extends AbstractDMContext { - +public class MIControlDMContext extends AbstractDMContext + implements ICommandControlDMContext +{ private final String fCommandControlFilter; private final String fCommandControlId; @@ -44,15 +46,19 @@ public class MIControlDMContext extends AbstractDMContext { public String getCommandControlFilter() { return fCommandControlFilter; } + + public String getCommandControlId() { + return fCommandControlId; + } @Override public boolean equals(Object obj) { - return baseEquals(obj) && fCommandControlFilter.equals(((MIControlDMContext)obj).fCommandControlFilter); + return baseEquals(obj) && fCommandControlId.equals(((MIControlDMContext)obj).fCommandControlId); } @Override public int hashCode() { - return baseHashCode() + fCommandControlFilter.hashCode(); + return baseHashCode() + fCommandControlId.hashCode(); } @Override diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/MIGDBExitEvent.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/MIGDBExitEvent.java index 57bf6595c27..64b598b08b0 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/MIGDBExitEvent.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/events/MIGDBExitEvent.java @@ -13,11 +13,15 @@ package org.eclipse.dd.mi.service.command.events; import org.eclipse.dd.dsf.concurrent.Immutable; +import org.eclipse.dd.dsf.debug.service.command.ICommandControlService; import org.eclipse.dd.mi.service.command.MIControlDMContext; /** * Gdb Session terminated. + * + * @deprecated This event is not used in DSF-GDB as it has been replaced by + * {@link ICommandControlService.ICommandControlShutdownDMEvent}. */ @Immutable public class MIGDBExitEvent extends MIEvent {