1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 308626 - Added a test for RejectedExecutionException.

This commit is contained in:
Pawel Piech 2010-05-20 23:10:15 +00:00
parent 5256a869aa
commit f27ab84b96

View file

@ -647,30 +647,60 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
/* (non-Javadoc)
* @see org.eclipse.debug.ui.contexts.ISourceDisplayAdapter#displaySource(java.lang.Object, org.eclipse.ui.IWorkbenchPage, boolean)
*/
public void displaySource(Object context, final IWorkbenchPage page,
final boolean force) {
public void displaySource(Object context, final IWorkbenchPage page, final boolean force) {
fStepCount = 0;
IExecutionDMContext displayThread = null;
IFrameDMContext displayFrame = null;
if (context instanceof IDMVMContext) {
IDMContext dmc = ((IDMVMContext) context).getDMContext();
if (dmc instanceof IFrameDMContext)
if (dmc instanceof IFrameDMContext) {
displayFrame = (IFrameDMContext) dmc;
} else if (context instanceof IFrameDMContext)
} else if (dmc instanceof IExecutionDMContext) {
displayThread = (IExecutionDMContext)dmc;
}
} else if (context instanceof IFrameDMContext) {
displayFrame = (IFrameDMContext) context;
} else if (context instanceof IExecutionDMContext) {
displayThread = (IExecutionDMContext)context;
}
// Quick test. DMC is checked again in source lookup participant, but
// it's much quicker to test here.
if (displayFrame != null)
doDisplaySource(displayFrame, page, force, false);
if (displayFrame != null) {
doDisplayFrameSource(displayFrame, page, force, false);
} else if (displayThread != null) {
doDisplayThreadSource(displayThread, page, force, false);
}
}
private void doDisplaySource(final IFrameDMContext context, final IWorkbenchPage page, final boolean force, final boolean eventTriggered) {
private void doDisplayThreadSource(final IExecutionDMContext context, final IWorkbenchPage page, final boolean force, final boolean eventTriggered) {
fExecutor.execute(new DsfRunnable() {
public void run() {
// We need to retrieve the frame level and line number from the service.
IStack stackService = fServicesTracker.getService(IStack.class);
if (stackService == null) {
return;
}
stackService.getTopFrame(
context,
new DataRequestMonitor<IFrameDMContext>(fExecutor, null) {
@Override
protected void handleSuccess() {
doDisplayFrameSource(getData(), page, force, eventTriggered);
}
});
}
});
}
private void doDisplayFrameSource(final IFrameDMContext context, final IWorkbenchPage page, final boolean force, final boolean eventTriggered) {
if (context.getLevel() < 0) {
return;
}
// Re-dispatch to executor thread before accessing job lists.
fExecutor.execute(new DsfRunnable() { public void run() {
fExecutor.execute(new DsfRunnable() {
public void run() {
// We need to retrieve the frame level and line number from the service.
IStack stackService = fServicesTracker.getService(IStack.class);
if (stackService == null) {
@ -699,8 +729,14 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
protected void handleFailure() {
doneStepping(context);
}
@Override
protected void handleRejectedExecutionException() {
doneStepping(context);
}
});
}
});
}});
}
private void executeFromJob(Runnable runnable) {
@ -838,7 +874,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
final IDMContext dmc = ((IDMVMContext)context).getDMContext();
if (dmc instanceof IFrameDMContext && DMContexts.isAncestorOf(dmc, e.getDMContext())) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
doDisplaySource((IFrameDMContext) dmc, page, false, true);
doDisplayFrameSource((IFrameDMContext) dmc, page, false, true);
return;
}
}