Fixed NPE on first start on Luna

In Luna preference initializers are called asynchronously outside of the UI thread.
The code used to get the current window was not working when not run on the UI thread.
The code from SWTUtils has a nice fallback.

Fixes #1002242