This will explain how to register a custom url handler to open files in Eclipse at a specific line number on Linux. After performing these instructions, you will be able to open urls of the form
openineclipse://open?url=$path-to-file?line=$linenumber
The instructions were tested on Ubuntu 15.10 but should work on most Gnome based distributions.
- Install
xdotool
sudo apt-get install xdotool
- Download the shell script. Save it somewhere and make it executable (
chmod +x
). Let’s say we save it to~/.scripst/open-in-eclipse.sh
. - Adapt the configuration constants in the scripst. You’ll need to at least modify
$ECLIPSE
. - Download the
.desktop
file and save it to~/.local/share/applications/open-in-eclipse.desktop
. Make it executable. - Adapt the path to the shell sript in the desktop file (line
4
) - register the url handler:
sudo update-desktop-database
xdg-mime default open-in-eclipse.desktop x-scheme-handler/openineclipse