User:Kevin Reid/Mac open event handler test

From Erights

Jump to: navigation, search

Can we have an E-on-Java app that handles Mac open events using the Apple Java extensions?

This does the obvious thing, but doesn't actually receive open events. Perhaps there is a which-thread-is-the-listener-invoked-on problem?

#!/usr/bin/env rune

# For something that might work in SWT see (directly registering an AppleEvent handler)

println("mainline a")
interp.waitAtTop(when (currentVat.morphInto("awt")) -> {
  println("getting App")
  def app := <>.getApplication()
  println("installing listener")
  app.addApplicationListener(def lis { 
    to handleOpenFile(ev) { 
      try {
        println(`got event $ev`)
      } catch p {
    match msg {
      println(`got msg $msg`)
  println("all set")
println("mainline b; blocking")


  • Written 2008-01-28.
  • Last experimented with 2009-05-12.
  • Published here 2010-10-01.
Personal tools
more tools