public static void pushButton(Dialog dialog, int id) {
Shell shell = dialog.getShell();
Button button = findButton(shell.getChildren(), id, shell);
if( !button.isEnabled() )
throw new RuntimeException("Error button to press is not enabled"); //$NON-NLS-1$
button.notifyListeners(SWT.Selection, new Event());
}
public static Button findButton(Dialog dialog, int id) {
Shell shell = dialog.getShell();
Button found = findButton(shell.getChildren(), id, shell);