简体   繁体   中英

Eclipse debugging : Stack trace on event

Im trying to get the code flow of an open source platform. I have got the source code and ran the program from eclipse. The program has an option called "Run job" and I want to know where the control goes when that option is clicked. How can achieve this?

First, try to identify the control with the label "Run job".

You could do this by searching the source code in Eclipse with Search > File and then setting "Containing Text" to "Run job" and "File name patterns" to "*.java".

Probably in the same file, there is an ActionListener (or similar) added to the control that calls a method, when the control is clicked. This is the method you're looking for. (Add a breakpoint to see the flow in the debugger or try to understand it from the code.)

Apart from searching for the appropriate handlers and buttons in the source code (if you know the names), you can also enable tracing.

In your run configuration, there should be a tab for tracing. There, you'll want to enable some of the options under org.eclipse.ui that start with trace/ .

有关如何启用跟踪的屏幕截图

You will get a lot of debug output, and there might be no trace option for the event you'd like to see. However it works well for things like keybindings ( trace/keyBindings ) and knowing which UI element got an event ( trace/graphics ). Note that some also take arguments, eg a commandId (something like org.eclipse.ui.edit.copy , will depend on your application).

You can find a small help text for each option here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM