Index: src/org/eclipse/jface/dialogs/Dialog.java =================================================================== RCS file: /home/eclipse/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java,v retrieving revision 1.3 diff -u -r1.3 Dialog.java --- src/org/eclipse/jface/dialogs/Dialog.java 24 Oct 2002 13:35:18 -0000 1.3 +++ src/org/eclipse/jface/dialogs/Dialog.java 31 Oct 2002 16:45:55 -0000 @@ -479,6 +479,45 @@ newShell.setFont(JFaceResources.getDialogFont()); } +/* + * @see Window.initializeBounds() + */ +protected void initializeBounds() { + String platform= SWT.getPlatform(); + if ("carbon".equals(platform)) { //$NON-NLS-1$ + // On Mac OS X the default button must be the right-most button + Shell shell= getShell(); + if (shell != null) { + Button defaultButton= shell.getDefaultButton(); + if (defaultButton != null && isContained(buttonBar, defaultButton)) { + Composite container= defaultButton.getParent(); + defaultButton.moveBelow(null); + } + } + } + + super.initializeBounds(); +} + +/** + * Returns true if the given Control c is a direct or indirect child of + * container. + */ +private boolean isContained(Control container, Control c) { + if (container instanceof Composite) { + Composite composite= (Composite) container; + Control[] children= composite.getChildren(); + if (children != null) { + for (int i= 0; i < children.length; i++) { + Control child= children[i]; + if (child == c || isContained(child, c)) + return true; + } + } + } + return false; +} + /** * The Dialog implementation of this Window method * creates and lays out the top level composite for the dialog, and