Found out how to handle events: class DisposeListenerImpl:DisposeListener{ public void widgetDisposed(DisposeEvent e) { writeln("Disposed"); } } shell.addDisposeListener(new DisposeListenerImpl); Is this the right way?