I'm using eclipse RCP with a view and I want to print something on the console when the application is closed.
This is what I have done, but It's not working;
public void createPartControl(final Composite parent){
parent.getShell().addListener(SWT.CLOSE, new Listener() {
@Override
public void handleEvent(Event event) {
System.out.println("NOW !");
}
});
}
EDIT: I found a solution, I needed to add a DisposeListener:
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
// TODO Auto-generated method stub
}
});
You want to use the SWT.Close
event and not SWT.CLOSE
. From the SWT Javadoc:
SWT.Close - The close event type (value is 21).
SWT.CLOSE - Style constant for close box trim (value is 1<<6, since we do not distinguish between CLOSE style and MENU style).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With