Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java222
1 files changed, 111 insertions, 111 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java
index f4ab7480ec..08d09fadbd 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MessageBox.java
@@ -1,16 +1,16 @@
-package org.eclipse.swt.widgets;
-
-/*
+package org.eclipse.swt.widgets;
+
+/*
* Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
* This file is made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.*;
-
+ * http://www.eclipse.org/legal/cpl-v10.html
+ */
+
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.photon.*;
+import org.eclipse.swt.*;
+
/**
* Instances of this class are used used to inform or warn the user.
* <dl>
@@ -31,8 +31,8 @@ import org.eclipse.swt.*;
* within the SWT implementation.
* </p>
*/
-public class MessageBox extends Dialog {
- String message = "";
+public class MessageBox extends Dialog {
+ String message = "";
/**
* Constructs a new instance of this class given only its
* parent.
@@ -55,9 +55,9 @@ public class MessageBox extends Dialog {
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*/
-public MessageBox (Shell parent) {
- this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
-}
+public MessageBox (Shell parent) {
+ this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
+}
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -88,20 +88,20 @@ public MessageBox (Shell parent) {
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*/
-public MessageBox (Shell parent, int style) {
- super (parent, checkStyle (style));
- checkSubclass ();
-}
-static int checkStyle (int style) {
- if ((style & (SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL)) == 0) style |= SWT.APPLICATION_MODAL;
- int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- int bits = style & mask;
- if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
- if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
- if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
- style = (style & ~mask) | SWT.OK;
- return style;
-}
+public MessageBox (Shell parent, int style) {
+ super (parent, checkStyle (style));
+ checkSubclass ();
+}
+static int checkStyle (int style) {
+ if ((style & (SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL)) == 0) style |= SWT.APPLICATION_MODAL;
+ int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
+ int bits = style & mask;
+ if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
+ if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
+ if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
+ style = (style & ~mask) | SWT.OK;
+ return style;
+}
/**
* Returns the dialog's message, which is a description of
* the purpose for which it was opened. This message will be
@@ -109,9 +109,9 @@ static int checkStyle (int style) {
*
* @return the message
*/
-public String getMessage () {
- return message;
-}
+public String getMessage () {
+ return message;
+}
/**
* Makes the dialog visible and brings it to the front
* of the display.
@@ -124,81 +124,81 @@ public String getMessage () {
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
* </ul>
*/
-public int open () {
- String[] buttons = null;
- if ((style & SWT.OK) == SWT.OK) {
- buttons = new String[]{SWT.getMessage ("SWT_OK")};
- }
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) {
- buttons = new String[]{SWT.getMessage ("SWT_OK"), SWT.getMessage ("SWT_Cancel")};
- }
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
- buttons = new String[]{SWT.getMessage ("SWT_Yes"), SWT.getMessage ("SWT_No")};
- }
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)){
- buttons = new String[]{SWT.getMessage ("SWT_Yes"), SWT.getMessage ("SWT_No"), SWT.getMessage ("SWT_Cancel")};
- }
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
- buttons = new String[]{SWT.getMessage ("SWT_Retry"), SWT.getMessage ("SWT_Cancel")};
- }
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
- buttons = new String[]{SWT.getMessage ("SWT_Abort"), SWT.getMessage ("SWT_Retry"), SWT.getMessage ("SWT_Cancel")};
- }
- if (buttons == null) buttons = new String[]{SWT.getMessage ("SWT_OK")};
-
- int phImage = 0;
-// int iconBits = 0;
-// if ((style & SWT.ICON_ERROR) != 0) iconBits = OS.MB_ICONERROR;
-// if ((style & SWT.ICON_INFORMATION) != 0) iconBits = OS.MB_ICONINFORMATION;
-// if ((style & SWT.ICON_QUESTION) != 0) iconBits = OS.MB_ICONQUESTION;
-// if ((style & SWT.ICON_WARNING) != 0) iconBits = OS.MB_ICONWARNING;
-// if ((style & SWT.ICON_WORKING) != 0) iconBits = OS.MB_ICONINFORMATION;
-
- int parentHandle = 0;
- if (parent != null && OS.PtWidgetIsRealized(parent.shellHandle)) {
- parentHandle = parent.shellHandle;
- }
- byte [] title = null;
- if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
- byte [] message = null;
- if (this.message != null) message = Converter.wcsToMbcs (null, this.message, true);
-
- int[] buttonsPtr = new int [buttons.length];
- for (int i=0; i<buttons.length; i++) {
- byte[] text = Converter.wcsToMbcs (null, buttons [i], true);
- int textPtr = OS.malloc (text.length);
- OS.memmove (textPtr, text, text.length);
- buttonsPtr [i] = textPtr;
- }
-
- int button = OS.PtAlert (parentHandle, null, title, phImage, message, null, buttons.length, buttonsPtr, null, 0, buttons.length, OS.Pt_MODAL);
-
- for (int i=0; i<buttons.length; i++) {
- OS.free (buttonsPtr [i]);
- }
-
- if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
- if (button == 1) return SWT.ABORT;
- if (button == 2) return SWT.RETRY;
- return SWT.IGNORE;
- }
- if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
- return (button == 1) ? SWT.RETRY : SWT.CANCEL;
- }
- if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) {
- if (button == 1) return SWT.YES;
- if (button == 2) return SWT.NO;
- return SWT.CANCEL;
- }
- if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
- return (button == 1) ? SWT.YES : SWT.NO;
- }
- if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) {
- return (button == 1) ? SWT.OK : SWT.CANCEL;
- }
- if ((style & SWT.OK) == SWT.OK && button == 1) return SWT.OK;
- return SWT.CANCEL;
-}
+public int open () {
+ String[] buttons = null;
+ if ((style & SWT.OK) == SWT.OK) {
+ buttons = new String[]{SWT.getMessage ("SWT_OK")};
+ }
+ if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) {
+ buttons = new String[]{SWT.getMessage ("SWT_OK"), SWT.getMessage ("SWT_Cancel")};
+ }
+ if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
+ buttons = new String[]{SWT.getMessage ("SWT_Yes"), SWT.getMessage ("SWT_No")};
+ }
+ if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)){
+ buttons = new String[]{SWT.getMessage ("SWT_Yes"), SWT.getMessage ("SWT_No"), SWT.getMessage ("SWT_Cancel")};
+ }
+ if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
+ buttons = new String[]{SWT.getMessage ("SWT_Retry"), SWT.getMessage ("SWT_Cancel")};
+ }
+ if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
+ buttons = new String[]{SWT.getMessage ("SWT_Abort"), SWT.getMessage ("SWT_Retry"), SWT.getMessage ("SWT_Cancel")};
+ }
+ if (buttons == null) buttons = new String[]{SWT.getMessage ("SWT_OK")};
+
+ int phImage = 0;
+// int iconBits = 0;
+// if ((style & SWT.ICON_ERROR) != 0) iconBits = OS.MB_ICONERROR;
+// if ((style & SWT.ICON_INFORMATION) != 0) iconBits = OS.MB_ICONINFORMATION;
+// if ((style & SWT.ICON_QUESTION) != 0) iconBits = OS.MB_ICONQUESTION;
+// if ((style & SWT.ICON_WARNING) != 0) iconBits = OS.MB_ICONWARNING;
+// if ((style & SWT.ICON_WORKING) != 0) iconBits = OS.MB_ICONINFORMATION;
+
+ int parentHandle = 0;
+ if (parent != null && OS.PtWidgetIsRealized(parent.shellHandle)) {
+ parentHandle = parent.shellHandle;
+ }
+ byte [] title = null;
+ if (this.title != null) title = Converter.wcsToMbcs (null, this.title, true);
+ byte [] message = null;
+ if (this.message != null) message = Converter.wcsToMbcs (null, this.message, true);
+
+ int[] buttonsPtr = new int [buttons.length];
+ for (int i=0; i<buttons.length; i++) {
+ byte[] text = Converter.wcsToMbcs (null, buttons [i], true);
+ int textPtr = OS.malloc (text.length);
+ OS.memmove (textPtr, text, text.length);
+ buttonsPtr [i] = textPtr;
+ }
+
+ int button = OS.PtAlert (parentHandle, null, title, phImage, message, null, buttons.length, buttonsPtr, null, 0, buttons.length, OS.Pt_MODAL);
+
+ for (int i=0; i<buttons.length; i++) {
+ OS.free (buttonsPtr [i]);
+ }
+
+ if ((style & (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) {
+ if (button == 1) return SWT.ABORT;
+ if (button == 2) return SWT.RETRY;
+ return SWT.IGNORE;
+ }
+ if ((style & (SWT.RETRY | SWT.CANCEL)) == (SWT.RETRY | SWT.CANCEL)) {
+ return (button == 1) ? SWT.RETRY : SWT.CANCEL;
+ }
+ if ((style & (SWT.YES | SWT.NO | SWT.CANCEL)) == (SWT.YES | SWT.NO | SWT.CANCEL)) {
+ if (button == 1) return SWT.YES;
+ if (button == 2) return SWT.NO;
+ return SWT.CANCEL;
+ }
+ if ((style & (SWT.YES | SWT.NO)) == (SWT.YES | SWT.NO)) {
+ return (button == 1) ? SWT.YES : SWT.NO;
+ }
+ if ((style & (SWT.OK | SWT.CANCEL)) == (SWT.OK | SWT.CANCEL)) {
+ return (button == 1) ? SWT.OK : SWT.CANCEL;
+ }
+ if ((style & SWT.OK) == SWT.OK && button == 1) return SWT.OK;
+ return SWT.CANCEL;
+}
/**
* Sets the dialog's message, which is a description of
* the purpose for which it was opened. This message will be
@@ -206,7 +206,7 @@ public int open () {
*
* @param string the message
*/
-public void setMessage (String string) {
- message = string;
-}
-}
+public void setMessage (String string) {
+ message = string;
+}
+}

Back to the top