Unpeeling the Magic

the hacky ways I make things work

OpenInEclipse Url Scheme for Mac

| Comments

What this does:

Enables you to externally open a specific file in eclipse, and go to some line

That is clicking on the following link: openineclipse://open?url=file:///etc/hosts&line=3 Will open /etc/hosts file and go to line 3

if you have a pretty standard setup you can probably just download OpenInEclipse.app.zip, unzip and place in /Applications

How to create this:

  • open AppleScript Editor and paste
  • If your eclipse isn’t located at “/Applications/eclipse/Eclipse.app”, modify
1
set path_to_eclipse to "the/correct/absolute/path/of/Eclipse.app"
  • Save as Application OpenInEclipse.app under /Applications
  • edit /Applications/OpenInEclipse.app/Contents/Info.plist and replace the last
      </dict>
      </plist>
    

    with:

Integrate with xdebug

  • add the following to php.ini in the xdebug section:
1
xdebug.file_link_format="openineclipse://open?url=file://%f&line=%l"
  • and restart apache:
1
$ sudo apachectl restart

Troubleshooting

In the AppleScript Editor uncomment:

1
  display alert "DEBUG: file " & filename & "   line " & line_number

Click on link again:

  • In the alert, are the filename and line_number parsed correctly? verify the href tag is correct or and that the code correctly parses the parameters

  • The alert displays the filename correctly but it doesn’t open:

Make sure path_to_eclipse is set to the correct location “/Applications/eclipse/Eclipse.app”

1
set path_to_eclipse to "the/correct/absolute/path/of/Eclipse.app"

Make sure eclipse is able to open a file from terminal, maybe your eclipse version is too old?

1
$ open -a /path/to/your/eclipse.app /etc/hosts
  • the file opens but it doesn’t go to the line number:

for system events to work with key code, you must “Enable access for assistive devices” in “System Preferences” under “Universal Access”

If you change the keyboard shortcut for go to line in eclipse, you’ll have to change the following line to send the correct key

1
 tell application "System Events" to key code 37 using command down #send command L 

finally, you can try to increase the sleep time before eclipse tries ‘go to line’ by modifying the following:

1
set sleep_before_going_to_line to "0.5" # in seconds

  • An alert does not display

LaunchServices is supposed to automatically register URL protocols of applications dragged to /Applications

You can see a list of all applications with registered url schemes as well as other information:

1
$ /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump > registeredapps.txt

`

under the bundle with the path: /Applications/OpenInEclipse.app you should find a claim id with the bindings openineclipse:

You can force OSX to re-register the url scheme of all applications in /Applications with the following command:

1
$ /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f -r /Applications

or you can use the system’s python to register just OpenInEclipse’s url scheme:

StarCraft II on a Case Sensitive Mac

| Comments

  • In Terminal, create the case insensitive installer Disc:
1
2
$ hdiutil create -size 8GB /starcraftdisc.sparsebundle -type SPARSEBUNDLE -fs HFS+J -volname "StarCraft II Disc" -layout NONE
$ open /starcraftdisc.sparsebundle
  • copy the contents of SC2-WingsOfLiberty-enUS-Installer downloaded with the starcraft downloader into “/Volumes/StarCraft II Disc” It should have the following files:
    • 102B Installer.app
    • 6.9G Installer Tome 1.MPQE
    • 40M Installer UI 2.MPQE
    • 2.4M Installer.exe
    • 8.3M Installer UI 1.MPQE
  • Go to ~/Library search for blizzard and delete any blizzard preferences files
  • Delete the Blizzard folder in /Users/Shared/
  • In terminal create the destination for installation:
1
2
3
4
$ hdiutil create -size 8GB /insensitive.sparsebundle -type SPARSEBUNDLE -fs HFS+J -volname "insensitive" -layout NONE
$ open /insensitive.sparsebundle
$ mkdir /Volumes/insensitive/Applications/
$ ln -s "/Volumes/insensitive/Applications/StarCraft II/" "/Applications/StarCraft II"
  • start the installer
  • select /Volumes/insensitive/Applications/StarCraft II/ as the installation directory
Real Time Web Analytics