Finding event handlers in source trees - netbeans

So, I'm trying to implement a looping mode in the totem movie player. I would like to do this by adding a checkbox under "Edit" that turns looping on.
I'm trying to figure out what code gets called when "Edit" and the "Shuffle Mode" option under it is clicked. Is there any easy way to find where the appropriate event handler is?
My usual method of code reading (stepping through it with the debugger) didn't work because this is a GUI program, and as soon as you get to the main loop it doesn't stop until there's a breakpoint, and where to put the breakpoints is basically what I'm trying to find out.
I've been using Netbeans for this, and I should note that I can't use Eclipse.
Thank you.

The UI for Totem and the callback names for each element defined in the GtkBuilder file, data/totem.ui.
http://git.gnome.org/browse/totem/tree/data/totem.ui
This file says that the handler for the "Shuffle Mode" action is shuffle_mode_action_callback. Then you can use grep:
grep -r shuffle_mode_action_callback totem-git/src
The result of this command indicates that this function is defined in src/totem-menu.c.

Related

Event listener breakpoints in Google Chrome Devtools

Event listener breakpoints in Google Chrome Devtools offers various number of options, but for me, they are not really of great use since they always throw me to some irrelevant part of code.
What I would like to know is if it is possible to limit it to just one class? For example onMouseClick send me to the 1st method that executes after mouse click, inside specific class. If none of the methods are fired inside this class, than simply do nothing.
You can set the breakpoints for each script and each line individually.
First open the debug-tools and chose a script in the sources-tab:
Then you can click on the line-number (here only no. 1) and it looks like this:
As you see now is the line marked, but also in the right col your individual breakpoint is listed.
After having marked the breakpoint you still have to reload the page that the scripts are executed again till to the breakpoint. Afterwards you can use the icons above the right col to step in or step over the commands following the breakpoint.
Having minified scripts, breakpoints are hard to use, so it's better to have a script where each line has only one command, it's much easier then to debug.
So for debugging you should change the corresponding script in your page to the non-minified version, perhaps also with a map-file if available.

how to know what are the lines covered in the code for a particular point of execution in eclipse

How to know what are the lines of code covered in the java class for a particular point of execution in eclipse. For example,if button click event is fired then how to know what are the lines of code is being executed during this event. Any plugins in eclipse or any free software for this to track the code ?
Go to the following page, it will instruct you through the process. The only thing you need to do is prepare a j-unit test for your code (for the method that gets called when pressing the button).
http://crunchify.com/what-is-the-best-code-coverage-plugin-you-should-use-in-eclipse-ide/

How to call function on js object from chrome dev tools?

Say I want to look at an object and so I log it to the console:
console.log(theNoticeObj);
Then using Chrome Dev Tools, I inspect it in the console and change its property theNoticeObj.bounceHeight to 10px
Now if I want to trigger theNoticeObj.bounce() on that object immediately to locate it, is there an easy way to do that from the console?
Thanks
EDIT:
Breakpoints where suggested below, but this freezes execution.
In face what I want is the command line API to work with javascript objects, not just DOM elements. If that were possible I'm sure I would be able to find it. I might go and see if there are any feature requests to that end for chrome.
https://developers.google.com/chrome-developer-tools/docs/console#using_the_command_line_api
Try adding window.tno = theNoticeObject under the console.log statement. Reload the page and see if you can execute tno.bounce() from the console. If theNoticeObject is still in scope, this should work.
You can navigate to the Sources tab and open your javascript file containing the piece of code you want to play with, in this case let us assume it is
console.log(theNoticeObj);
Once you find this line, you can set a breakpoint at this point and when your program execution comes to this line it will halt.
You can then use the Console tab to do operations on all the javascript objects in current local scope, window scope. You can simply call:
theNoticeObj.bounce();
It executes in the current context reflecting changes on the screen.
Hope this helps.
Now you can right click any object in the console and use "Store as global variable".
A new console line appears with the name of a new global variable holding reference to the selected object.

Eclipse (ctrl+space) content assist hook

I wrote a plugin that gets user input from Java editor, makes some computation, and writes the results to my view. The way I start the process of aforementioned computation is via context menu and I hate it. I would like it to start on ctrl+space, i.e. content assist. It is faster, more intuitive w.r.t. what the plugin does. Is there a way to do so?
Update:
For example, what should I do to get the current cursor position when user presses ctrl+space? I would use that position info and print it to my view. This is the most simplistic plugin that I basically need.
You could take part in the content assistent calculation of Ctrl-Space by extending javaCompletionProposalComputer. However, if you want to trigger some arbitrary modification operation on the Java file, you are better suited by providing a quick assist instead.
If you are confused by the terms: An example for quick assist is the suggestion "Invert if statement", which you can see when pressing Ctrl-1 with the cursor placed on an "if".

How can I run initial subroutine after opening new window

In my Perl/Tk script I'm opening new windows, and i want the window opening will run an initial subroutine (when ever the window is opened)
How can I do it?
One way is to call the subroutine from the code that creates and/or raises the window. If you want the call to be bound to the action itself rather than the invocation of that action (maybe because the window could be opened from multiple places in the code) you would need to create an event binding. e.g.
$window->bind('<Map>', \&mysub);
Depending on what precisely you're trying to do, you might want to bind to the Create, Activate, or Visibility events instead. See the Tk event type documentation for more information.