Bug 560348 - Wrong toolbar debug button state with two windows

When debugging with 2 workbench windows, sometimes the main toolbar
debug buttons enabled state is incorrect. E.g. step over would be
disabled in 1 window, but not in the other window.

This is caused by job cancellation in
DebugCommandService.postUpdateCommand(). In particular, each window will
schedule an AbstractDebugCommand.UpdateJob per debug command (suspend,
resume, step over, etc.) and some of those jobs are cancelled by
postUpdateCommand(). A cancelled job can contain the action to update
for a specific window, in UpdateActionsRequest.fActions (stored in
AbstractDebugCommand.UpdateJob.request). The cancellation does not take
this into account, sometimes leading to wrong main toolbar debug button
states in either window.

This change disables the job cancellation if there are 2 or more
workbench windows.

In addition, the change moves cancellation to before new UpdateJobs are
triggered. This avoids cases in which updates triggered by a custom
debug context provider become cancelled, but newer updates only come
much later on from the Debug view context provider.

Change-Id: Ic9d4f87882982e745dfa4fb41f7ed0d856533566
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
1 file changed