Exemplo n.º 1
0
  protected void openDialog() {

    if (Const.isWindows()) {
      shell.setSize(653, 671);
    }
    if (Const.isLinux()) {
      shell.setSize(740, 678);
    }
    if (Const.isOSX()) {
      shell.setSize(653, 678);
    }

    // Set the focus on the OK button
    wOK.setFocus();
    shell.open();

    Rectangle shellBounds = getParent().getBounds();
    Point dialogSize = shell.getSize();

    shell.setLocation(
        shellBounds.x + (shellBounds.width - dialogSize.x) / 2,
        shellBounds.y + (shellBounds.height - dialogSize.y) / 2);

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
  }