diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java index 49658a98dae..c330bee5615 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/AbstractDebugVMAdapter.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel; +import java.util.concurrent.RejectedExecutionException; + import org.eclipse.dd.dsf.concurrent.DsfRunnable; import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.SteppingController.ISteppingControlParticipant; import org.eclipse.dd.dsf.debug.service.IRunControl; @@ -32,11 +34,13 @@ public class AbstractDebugVMAdapter extends AbstractDMVMAdapter public AbstractDebugVMAdapter(DsfSession session, final SteppingController controller) { super(session); fController = controller; - fController.getExecutor().execute(new DsfRunnable() { - public void run() { - fController.addSteppingControlParticipant(AbstractDebugVMAdapter.this); - } - }); + try { + fController.getExecutor().execute(new DsfRunnable() { + public void run() { + fController.addSteppingControlParticipant(AbstractDebugVMAdapter.this); + } + }); + } catch (RejectedExecutionException e) {} // Do nothing if session is shut down. } private final SteppingController fController; @@ -60,13 +64,13 @@ public class AbstractDebugVMAdapter extends AbstractDMVMAdapter @Override public void dispose() { - if (!fController.getExecutor().isShutdown()) { + try { fController.getExecutor().execute(new DsfRunnable() { public void run() { fController.removeSteppingControlParticipant(AbstractDebugVMAdapter.this); } }); - } + } catch (RejectedExecutionException e) {} // Do nothing if session is shut down. super.dispose(); } } diff --git a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java index 679ccec448d..871b3ce0c08 100644 --- a/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java +++ b/plugins/org.eclipse.dd.examples.pda.ui/src/org/eclipse/dd/examples/pda/ui/PDAAdapterFactory.java @@ -187,9 +187,12 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2 PDALaunch launch = (PDALaunch)adaptableObject; - // check for valid session + // Check for valid session. + // Note: even if the session is no longer active, the adapter set + // should still be returned. This is because the view model may still + // need to show elements representing a terminated process/thread/etc. DsfSession session = launch.getSession(); - if (session == null || !session.isActive()) return null; + 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 diff --git a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/GdbAdapterFactory.java b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/GdbAdapterFactory.java index 6645cb09f79..0158aa1912c 100644 --- a/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/GdbAdapterFactory.java +++ b/plugins/org.eclipse.dd.gdb.ui/src/org/eclipse/dd/gdb/internal/ui/GdbAdapterFactory.java @@ -208,9 +208,12 @@ public class GdbAdapterFactory GdbLaunch launch = (GdbLaunch)adaptableObject; - // check for valid session + // Check for valid session. + // Note: even if the session is no longer active, the adapter set + // should still be returned. This is because the view model may still + // need to show elements representing a terminated process/thread/etc. DsfSession session = launch.getSession(); - if (session == null || !session.isActive()) return null; + if (session == null) return null; // Find the correct set of adapters based on the launch session-ID. If not found // it means that we have a new launch and new session, and we have to create a