Aneesh
Aneesh

Reputation: 1733

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?

Upvotes: 1

Views: 584

Answers (2)

jmiserez
jmiserez

Reputation: 3109

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/.

Screenshot on how to enable tracing

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, e.g. 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.

Upvotes: 2

Ralf Wagner
Ralf Wagner

Reputation: 1517

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.)

Upvotes: 2

Related Questions