Eclipse plugin - handling events when stepping or breaking

后端 未结 1 1222
庸人自扰
庸人自扰 2021-01-07 09:43

Is there a generic way of receiving event notifications from the Eclipse debugger. Specifically I would just like to know when the user steps over/into and when a breakpoint

相关标签:
1条回答
  • 2021-01-07 10:18

    OK, I've found an alternative that may be of use for others. You can use the method outlined above to listen for debug events when the session is created and terminated.

    For any stepping events, one way I found was to register an IExecutionListener to be notified of all commands that take place in the Eclipse workspace. You can register an execution listener by getting hold of an ICommandService as follows:

    ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)
    

    Then add an execution listener:

    commandService.addExecutionListener(this);
    

    This will give you various event handlers (notHandled, postExecuteFailure, postExecuteSuccess, preExecute) from which you can filter by the commandId value.

    I hope this helps someone else.

    Alan

    0 讨论(0)
提交回复
热议问题