Source:
private void getContainerDMContexts(final IDebugCommandRequest request, final DataRequestMonitor<IContainerDMContext[]> rm) { GdbLaunch launch = null; final Set<IContainerDMContext> contDmcs = new HashSet<IContainerDMContext>(); for (Object obj : request.getElements()) { if (obj instanceof GdbLaunch && ((GdbLaunch)obj).getSession().getId().equals(fSession.getId())) { launch = (GdbLaunch)obj; break; } if (obj instanceof IDMVMContext) { IContainerDMContext contDmc = DMContexts.getAncestorOfType(((IDMVMContext)obj).getDMContext(), IContainerDMContext.class); if (contDmc != null) { contDmcs.add(contDmc); } } } if (launch == null) { rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()])); rm.done(); } else { try { ImmediateExecutor.getInstance().execute(new DsfRunnable() { @Override public void run() { ICommandControlService commandControl = fTracker.getService(ICommandControlService.class); final IProcesses procService = fTracker.getService(IProcesses.class); if (commandControl != null && procService != null) { procService.getProcessesBeingDebugged( commandControl.getContext(), new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleCompleted() { if (!isSuccess()) { rm.setStatus(getStatus()); } else { for (IDMContext ctx : getData()) { IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class); if (contDmc != null) { contDmcs.add(contDmc); } } rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()])); } rm.done(); }; }); } else { request.done(); } } }); } catch (RejectedExecutionException e) { request.done(); } } }

Target:
private void getContainerDMContexts(final IDebugCommandRequest request, final DataRequestMonitor<IContainerDMContext[]> rm) { GdbLaunch launch = null; final Set<IContainerDMContext> contDmcs = new HashSet<IContainerDMContext>(); for (Object obj : request.getElements()) { if (obj instanceof GdbLaunch) { launch = (GdbLaunch)obj; break; } if (obj instanceof IDMVMContext) { IContainerDMContext contDmc = DMContexts.getAncestorOfType(((IDMVMContext)obj).getDMContext(), IContainerDMContext.class); if (contDmc != null) { contDmcs.add(contDmc); } } } if (launch == null) { rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()])); rm.done(); } else { try { fExecutor.execute(new DsfRunnable() { @Override public void run() { ICommandControlService commandControl = fTracker.getService(ICommandControlService.class); final IProcesses procService = fTracker.getService(IProcesses.class); if (commandControl != null && procService != null) { procService.getProcessesBeingDebugged( commandControl.getContext(), new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleCompleted() { if (!isSuccess()) { rm.setStatus(getStatus()); } else { for (IDMContext ctx : getData()) { IContainerDMContext contDmc = DMContexts.getAncestorOfType(ctx, IContainerDMContext.class); if (contDmc != null) { contDmcs.add(contDmc); } } rm.setData(contDmcs.toArray(new IContainerDMContext[contDmcs.size()])); } rm.done(); }; }); } else { request.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Service is not available.")); request.done(); } } }); } catch (RejectedExecutionException e) { request.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, e.getLocalizedMessage())); request.done(); } } }