title: Get Active Shell in SWT, even if the Shell is not on focus
body: <p><code>Display.getActiveShell()</code> seems to only consider a Shell as active if it's focused. If at the moment another application has focus that means <code>Display.getActiveShell()</code> returns <code>null</code>. </p>
  
  <p>I need a method that will always tell me which is the Shell on focus on my SWT application, even when my SWT application is not on focus.</p>
  
  <p>I've quickly hacked this piece of code together, although sometimes I get an <code>AssertionException</code>:</p>
  
  <pre><code>public static Shell getActiveShell() {
      Display display = Display.getDefault();
      Shell result = display.getActiveShell();
  
      if (result == null) {
          Shell[] shells = display.getShells();
          for (Shell shell : shells) {
              if (shell.getShells().length == 0) {
                  if (result != null)
                      throw new AssertionException();
                  result = shell;
              }
          }
      }
  
      return result;
  }
  </code></pre>
  
  <p>Is there any standard way to approach this issue other than writing your own method?</p>