/** Set initial size and layout for the window then open it */
  private void openWindow() {

    /*
     * Using initialMaxNumberOfPanels as a lower limit we exclude all other panels from the layout,
     * compute the window size, then finally we include all panels back into the layout
     *
     *  This ensures that the window will fit exactly the desired number of panels
     */
    Control[] controls = scrollChild.getChildren();
    for (int i = (initialMaxNumberOfPanels); i < controls.length; i++) {
      ((GridData) controls[i].getLayoutData()).exclude = true;
    }

    Point p = shell.computeSize(defaultShellWidth, SWT.DEFAULT);

    for (int i = 0; i < controls.length; i++) {
      ((GridData) controls[i].getLayoutData()).exclude = false;
    }
    formatLastPanel(null);
    scrollChild.layout();

    /*
     * Set the shell size if it's different that the computed size
     */
    if (false == shell.getSize().equals(p)) {
      shell.setSize(p);
      shell.layout(false);
    }

    /*
     * Centers the window
     */

    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (null == uiFunctions) {
      /*
       * Centers on the active monitor
       */
      Utils.centreWindow(shell);
    } else {
      /*
       * Centers on the main application window
       */
      Utils.centerWindowRelativeTo(shell, uiFunctions.getMainShell());
    }

    shell.open();
  }