diff options
6 files changed, 255 insertions, 214 deletions
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java index ce756d66613..f0170f0a054 100644 --- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java +++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java @@ -10,43 +10,14 @@ *******************************************************************************/ package org.eclipse.cdt.examples.dsf.pda.ui; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.cdt.dsf.concurrent.Immutable; import org.eclipse.cdt.dsf.concurrent.ThreadSafe; -import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand; -import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepIntoCommand; -import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepOverCommand; -import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepReturnCommand; -import org.eclipse.cdt.dsf.debug.ui.actions.DsfSuspendCommand; -import org.eclipse.cdt.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter; -import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController; -import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory; import org.eclipse.cdt.dsf.service.DsfSession; -import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; import org.eclipse.cdt.examples.dsf.pda.launch.PDALaunch; -import org.eclipse.cdt.examples.dsf.pda.ui.actions.PDATerminateCommand; -import org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.PDAVMAdapter; import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchesListener2; -import org.eclipse.debug.core.commands.IResumeHandler; -import org.eclipse.debug.core.commands.IStepIntoHandler; -import org.eclipse.debug.core.commands.IStepOverHandler; -import org.eclipse.debug.core.commands.IStepReturnHandler; -import org.eclipse.debug.core.commands.ISuspendHandler; -import org.eclipse.debug.core.commands.ITerminateHandler; -import org.eclipse.debug.core.model.IDebugModelProvider; -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; +import org.eclipse.debug.ui.contexts.ISuspendTrigger; /** * The adapter factory is the central point of control of view model and other @@ -61,146 +32,8 @@ import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; */ @ThreadSafe @SuppressWarnings({"restriction"}) -public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2 +public class PDAAdapterFactory implements IAdapterFactory { - /** - * Contains the set of adapters that are created for each launch instance. - */ - @Immutable - private static class LaunchAdapterSet { - // View Model adapter - final PDAVMAdapter fViewModelAdapter; - - // Source lookup and positioning adapter - final DsfSourceDisplayAdapter fSourceDisplayAdapter; - - // Command adapters - final DsfStepIntoCommand fStepIntoCommand; - final DsfStepOverCommand fStepOverCommand; - final DsfStepReturnCommand fStepReturnCommand; - final DsfSuspendCommand fSuspendCommand; - final DsfResumeCommand fResumeCommand; - final PDATerminateCommand fTerminateCommand; - - // Adapters for integration with other UI actions - final IDebugModelProvider fDebugModelProvider; - final PDALaunch fLaunch; - - final SteppingController fSteppingController; - - private IModelSelectionPolicyFactory fModelSelectionPolicyFactory; - - LaunchAdapterSet(PDALaunch launch) { - // Initialize launch and session. - fLaunch = launch; - DsfSession session = launch.getSession(); - - // register stepping controller - fSteppingController = new SteppingController(session); - session.registerModelAdapter(SteppingController.class, fSteppingController); - - // Initialize VM - fViewModelAdapter = new PDAVMAdapter(session, fSteppingController); - - // Initialize source lookup - fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController); - 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); - fStepOverCommand = new DsfStepOverCommand(session, null); - fStepReturnCommand = new DsfStepReturnCommand(session); - fSuspendCommand = new DsfSuspendCommand(session); - fResumeCommand = new DsfResumeCommand(session); - fTerminateCommand = new PDATerminateCommand(session); - session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand); - session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand); - session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand); - session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand); - session.registerModelAdapter(IResumeHandler.class, fResumeCommand); - session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand); - - // Initialize debug model provider - fDebugModelProvider = new IDebugModelProvider() { - public String[] getModelIdentifiers() { - return new String[] { PDAPlugin.ID_PDA_DEBUG_MODEL }; - } - }; - session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider); - - // Register the launch as an adapter This ensures that the launch, - // and debug model ID will be associated with all DMContexts from this - // session. - session.registerModelAdapter(ILaunch.class, fLaunch); - } - - void dispose() { - DsfSession session = fLaunch.getSession(); - - fViewModelAdapter.dispose(); - - session.unregisterModelAdapter(ISourceDisplay.class); - if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose(); - - session.unregisterModelAdapter(SteppingController.class); - fSteppingController.dispose(); - - session.unregisterModelAdapter(IModelSelectionPolicyFactory.class); - - session.unregisterModelAdapter(IStepIntoHandler.class); - session.unregisterModelAdapter(IStepOverHandler.class); - session.unregisterModelAdapter(IStepReturnHandler.class); - session.unregisterModelAdapter(ISuspendHandler.class); - session.unregisterModelAdapter(IResumeHandler.class); - session.unregisterModelAdapter(ITerminateHandler.class); - fStepIntoCommand.dispose(); - fStepOverCommand.dispose(); - fStepReturnCommand.dispose(); - fSuspendCommand.dispose(); - fResumeCommand.dispose(); - fTerminateCommand.dispose(); - } - } - - /** - * Active adapter sets. They are accessed using the launch instance - * which owns the debug services session. - */ - private static Map<PDALaunch, LaunchAdapterSet> fgLaunchAdapterSets = - Collections.synchronizedMap(new HashMap<PDALaunch, LaunchAdapterSet>()); - - /** - * Map of launches for which adapter sets have already been disposed. - * This map (used as a set) is maintained in order to avoid re-creating an - * adapter set after the launch was removed from the launch manager, but - * while the launch is still being held by other classes which may - * request its adapters. A weak map is used to avoid leaking - * memory once the launches are no longer referenced. - * <p> - * Access to this map is synchronized using the fgLaunchAdapterSets - * instance. - * </p> - */ - private static Map<ILaunch, Object> fgDisposedLaunchAdapterSets = - new WeakHashMap<ILaunch, Object>(); - - static void disposeAdapterSet(ILaunch launch) { - synchronized(fgLaunchAdapterSets) { - if ( fgLaunchAdapterSets.containsKey(launch) ) { - fgLaunchAdapterSets.remove(launch).dispose(); - fgDisposedLaunchAdapterSets.put(launch, null); - } - } - } - - public PDAAdapterFactory() { - DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); - } - // This IAdapterFactory method returns adapters for the PDA launch object only. @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3 public Object getAdapter(Object adaptableObject, Class adapterType) { @@ -215,26 +48,12 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2 DsfSession session = launch.getSession(); if (session == null) return null; - // Find the correct set of adapters based on the launch. If not found - // it means that we have a new launch, and we have to create a - // new set of adapters. - LaunchAdapterSet adapterSet; - synchronized(fgLaunchAdapterSets) { - // The adapter set for the given launch was already disposed. - // Return a null adapter. - if (fgDisposedLaunchAdapterSets.containsKey(launch)) { - return null; - } - adapterSet = fgLaunchAdapterSets.get(launch); - if (adapterSet == null) { - adapterSet = new LaunchAdapterSet(launch); - fgLaunchAdapterSets.put(launch, adapterSet); - } - } + SessionAdapterSet adapterSet = PDAUIPlugin.getDefault().getAdapterSet(launch); // Returns the adapter type for the launch object. if (adapterType.equals(IElementContentProvider.class)) return adapterSet.fViewModelAdapter; else if (adapterType.equals(IModelProxyFactory.class)) return adapterSet.fViewModelAdapter; + else if (adapterType.equals(ISuspendTrigger.class)) return adapterSet.fSuspendTrigger; else return null; } @@ -243,24 +62,4 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2 return new Class[] { IElementContentProvider.class, IModelProxyFactory.class, IColumnPresentationFactory.class }; } - public void launchesRemoved(ILaunch[] launches) { - // Dispose the set of adapters for a launch only after the launch is - // removed from the view. If the launch is terminated, the adapters - // are still needed to populate the contents of the view. - for (ILaunch launch : launches) { - if (launch instanceof PDALaunch) { - disposeAdapterSet(launch); - } - } - } - - public void launchesTerminated(ILaunch[] launches) { - } - - public void launchesAdded(ILaunch[] launches) { - } - - public void launchesChanged(ILaunch[] launches) { - } - } diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java index 79d2dbded49..91bdf484a4a 100644 --- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java +++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java @@ -13,12 +13,16 @@ package org.eclipse.cdt.examples.dsf.pda.ui; import java.net.URL; +import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.WeakHashMap; +import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.examples.dsf.pda.launch.PDALaunch; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchesListener2; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.swt.graphics.Color; @@ -31,7 +35,7 @@ import org.osgi.framework.BundleContext; /** * The main plugin class to be used in the desktop. */ -public class PDAUIPlugin extends AbstractUIPlugin { +public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2{ public static String PLUGIN_ID = "org.eclipse.cdt.examples.dsf.pda.ui "; @@ -59,6 +63,38 @@ public class PDAUIPlugin extends AbstractUIPlugin { */ private Map<RGB, Color> fColors = new HashMap<RGB, Color>(); + /** + * Active adapter sets. They are accessed using the DSF session ID + * which owns the debug services. + */ + private Map<String, SessionAdapterSet> fSessionAdapterSets = + Collections.synchronizedMap(new HashMap<String, SessionAdapterSet>()); + + /** + * Map of launches for which adapter sets have already been disposed. + * This map (used as a set) is maintained in order to avoid re-creating an + * adapter set after the launch was removed from the launch manager, but + * while the launch is still being held by other classes which may + * request its adapters. A weak map is used to avoid leaking + * memory once the launches are no longer referenced. + * <p> + * Access to this map is synchronized using the fSessionAdapterSets + * instance. + * </p> + */ + private Map<ILaunch, Object> fDisposedSessionAdapterSets = + new WeakHashMap<ILaunch, Object>(); + + private void disposeAdapterSet(PDALaunch launch) { + String sessionId = launch.getSession().getId(); + synchronized(fSessionAdapterSets) { + if ( fSessionAdapterSets.containsKey(sessionId) ) { + fSessionAdapterSets.remove(sessionId).dispose(); + fDisposedSessionAdapterSets.put(launch, null); + } + } + } + /** * The constructor. */ @@ -74,10 +110,7 @@ public class PDAUIPlugin extends AbstractUIPlugin { public void start(BundleContext context) throws Exception { fContext = context; super.start(context); -// Toggles single threaded adapter example -// IAdapterManager adapterManager = Platform.getAdapterManager(); -// IAdapterFactory factory = new AdapterFactory(); -// adapterManager.registerAdapters(factory, PDADebugTarget.class); + DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); } /** @@ -85,6 +118,7 @@ public class PDAUIPlugin extends AbstractUIPlugin { */ @Override public void stop(BundleContext context) throws Exception { + DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); disposeAdapterSets(); super.stop(context); plugin = null; @@ -141,15 +175,66 @@ public class PDAUIPlugin extends AbstractUIPlugin { return color; } + SessionAdapterSet getAdapterSet(PDALaunch launch) { + // Find the correct set of adapters based on the launch. If not found + // it means that we have a new launch, and we have to create a + // new set of adapters. + SessionAdapterSet adapterSet; + synchronized(fSessionAdapterSets) { + // The adapter set for the given launch was already disposed. + // Return a null adapter. + if (fDisposedSessionAdapterSets.containsKey(launch)) { + return null; + } + String sessionId = launch.getSession().getId(); + adapterSet = fSessionAdapterSets.get(sessionId); + if (adapterSet == null) { + adapterSet = new SessionAdapterSet(launch); + fSessionAdapterSets.put(sessionId, adapterSet); + } + } + return adapterSet; + } + + SessionAdapterSet getAdapterSet(String sessionId) { + DsfSession session = DsfSession.getSession(sessionId); + ILaunch launch = (ILaunch)session.getModelAdapter(ILaunch.class); + if (launch instanceof PDALaunch) { + return getAdapterSet((PDALaunch)launch); + } + return null; + } + /** * Dispose adapter sets for all launches. */ private void disposeAdapterSets() { for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) { if (launch instanceof PDALaunch) { - PDAAdapterFactory.disposeAdapterSet(launch); + disposeAdapterSet((PDALaunch)launch); } } } - } + public void launchesRemoved(ILaunch[] launches) { + // Dispose the set of adapters for a launch only after the launch is + // removed from the view. If the launch is terminated, the adapters + // are still needed to populate the contents of the view. + for (ILaunch launch : launches) { + if (launch instanceof PDALaunch) { + disposeAdapterSet((PDALaunch)launch); + } + } + } + + public void launchesTerminated(ILaunch[] launches) { + } + + public void launchesAdded(ILaunch[] launches) { + } + + public void launchesChanged(ILaunch[] launches) { + } + +} + diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java new file mode 100644 index 00000000000..6aa7883c017 --- /dev/null +++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java @@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2009 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.examples.dsf.pda.ui; + +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand; +import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepIntoCommand; +import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepOverCommand; +import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepReturnCommand; +import org.eclipse.cdt.dsf.debug.ui.actions.DsfSuspendCommand; +import org.eclipse.cdt.dsf.debug.ui.contexts.DsfSuspendTrigger; +import org.eclipse.cdt.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter; +import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController; +import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory; +import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfSelectionPolicy; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext; +import org.eclipse.cdt.examples.dsf.pda.PDAPlugin; +import org.eclipse.cdt.examples.dsf.pda.launch.PDALaunch; +import org.eclipse.cdt.examples.dsf.pda.ui.actions.PDATerminateCommand; +import org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.PDAVMAdapter; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.commands.IResumeHandler; +import org.eclipse.debug.core.commands.IStepIntoHandler; +import org.eclipse.debug.core.commands.IStepOverHandler; +import org.eclipse.debug.core.commands.IStepReturnHandler; +import org.eclipse.debug.core.commands.ISuspendHandler; +import org.eclipse.debug.core.commands.ITerminateHandler; +import org.eclipse.debug.core.model.IDebugModelProvider; +import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; +import org.eclipse.debug.ui.targets.ITargetsUIConstants; + +/** + * Contains the set of adapters that are created for each session instance. + */ +class SessionAdapterSet { + // View Model adapter + final PDAVMAdapter fViewModelAdapter; + + // Source lookup and positioning adapter + final DsfSourceDisplayAdapter fSourceDisplayAdapter; + + // Command adapters + final DsfStepIntoCommand fStepIntoCommand; + final DsfStepOverCommand fStepOverCommand; + final DsfStepReturnCommand fStepReturnCommand; + final DsfSuspendCommand fSuspendCommand; + final DsfResumeCommand fResumeCommand; + final PDATerminateCommand fTerminateCommand; + final DsfSuspendTrigger fSuspendTrigger; + + // Adapters for integration with other UI actions + final IDebugModelProvider fDebugModelProvider; + final PDALaunch fLaunch; + + final SteppingController fSteppingController; + + final IModelSelectionPolicyFactory fModelSelectionPolicyFactory; + + SessionAdapterSet(PDALaunch launch) { + // Initialize launch and session. + fLaunch = launch; + DsfSession session = launch.getSession(); + + // register stepping controller + fSteppingController = new SteppingController(session); + session.registerModelAdapter(SteppingController.class, fSteppingController); + + // Initialize VM + fViewModelAdapter = new PDAVMAdapter(session, fSteppingController); + + // Initialize source lookup + fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController); + 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); + fStepOverCommand = new DsfStepOverCommand(session, null); + fStepReturnCommand = new DsfStepReturnCommand(session); + fSuspendCommand = new DsfSuspendCommand(session); + fResumeCommand = new DsfResumeCommand(session); + fTerminateCommand = new PDATerminateCommand(session); + fSuspendTrigger = new DsfSuspendTrigger(session, fLaunch); + + session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand); + session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand); + session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand); + session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand); + session.registerModelAdapter(IResumeHandler.class, fResumeCommand); + session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand); + + // Initialize debug model provider + fDebugModelProvider = new IDebugModelProvider() { + public String[] getModelIdentifiers() { + return new String[] { PDAPlugin.ID_PDA_DEBUG_MODEL }; + } + }; + session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider); + } + + void dispose() { + DsfSession session = fLaunch.getSession(); + + fViewModelAdapter.dispose(); + + session.unregisterModelAdapter(ISourceDisplay.class); + if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose(); + + session.unregisterModelAdapter(SteppingController.class); + fSteppingController.dispose(); + + session.unregisterModelAdapter(IModelSelectionPolicyFactory.class); + + session.unregisterModelAdapter(IStepIntoHandler.class); + session.unregisterModelAdapter(IStepOverHandler.class); + session.unregisterModelAdapter(IStepReturnHandler.class); + session.unregisterModelAdapter(ISuspendHandler.class); + session.unregisterModelAdapter(IResumeHandler.class); + session.unregisterModelAdapter(ITerminateHandler.class); + fStepIntoCommand.dispose(); + fStepOverCommand.dispose(); + fStepReturnCommand.dispose(); + fSuspendCommand.dispose(); + fResumeCommand.dispose(); + fTerminateCommand.dispose(); + fSuspendTrigger.dispose(); + } + +} diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java index 87ff4b8362a..2f510f65fd1 100644 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java +++ b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/launch/PDALaunch.java @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.Launch; import org.eclipse.debug.core.model.ISourceLocator; @@ -73,6 +74,11 @@ implements ITerminate dsfExecutor.prestartCoreThread(); fExecutor = dsfExecutor; fSession = DsfSession.startSession(fExecutor, PDAPlugin.ID_PDA_DEBUG_MODEL); + + // Register the launch as an adapter This ensures that the launch, + // and debug model ID will be associated with all DMContexts from this + // session. + fSession.registerModelAdapter(ILaunch.class, this); } /** diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java index bfa653ba01a..5b6b394260b 100644 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java +++ b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDACommandControl.java @@ -155,7 +155,11 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon // Register the service with OSGi as the last step in initialization of // the service. register( - new String[]{ ICommandControl.class.getName(), PDACommandControl.class.getName() }, + new String[] { + ICommandControl.class.getName(), + ICommandControlService.class.getName(), + PDACommandControl.class.getName() + }, new Hashtable<String,String>()); rm.done(); diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java index 4ead1401aa1..055a44ae14e 100644 --- a/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java +++ b/dsf/org.eclipse.cdt.examples.dsf.pda/src/org/eclipse/cdt/examples/dsf/pda/service/PDARunControl.java @@ -34,6 +34,7 @@ import org.eclipse.cdt.examples.dsf.pda.service.commands.PDACommandResult; import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAResumeCommand; import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAStepCommand; import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAStepReturnCommand; +import org.eclipse.cdt.examples.dsf.pda.service.commands.PDASuspendCommand; import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAVMResumeCommand; import org.eclipse.cdt.examples.dsf.pda.service.commands.PDAVMSuspendCommand; import org.osgi.framework.BundleContext; @@ -554,7 +555,7 @@ public class PDARunControl extends AbstractDsfService final PDAThreadDMContext threadCtx = (PDAThreadDMContext)context; fThreads.get(threadCtx.getID()).fSuspendPending = true; fCommandControl.queueCommand( - new PDAVMSuspendCommand(fDMContext), + new PDASuspendCommand(threadCtx), new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) { @Override protected void handleFailure() { |