Archive for January, 2009

Use rails-footnotes to open files in NetBeans from Firefox

Friday, January 16th, 2009

Here is how to use rails-footnotes with NetBeans on linux!

Thanks to José Valim we have a nice new plugin for better debugging of Rails applications! In his blog post he describes how to open links to files on your hard disk with notepad++ on windows. I adapted this idea for opening files with netbeans on linux, and here is your way to go:

open about:config in firefox and add:

  • string network.protocol-handler.app.editor with content ~/.editor.rb
  • bool network.protocol-handler.external.editor and set it to true

create the file ~/.editor.rb and make it executable:

touch ~/.editor.rb && chmod +x  ~/.editor.rb

And here is the content:

#!/usr/bin/ruby
file = ARGV.first.split('file://').last.split('&').first
line = /\&line\=(\d+)/.match(ARGV.first)[1] rescue 0
`"/path/to/your/netbeans-dir/bin/netbeans" "#{file}:#{line}"`
`wmctrl -a "NetBeans IDE"`

install wmctrl

sudo aptitude install wmctrl

We’ll need this to give focus to the NetBeans window.