~ubuntu-branches/debian/sid/swt-gtk/sid

« back to all changes in this revision

Viewing changes to org/eclipse/swt/widgets/MessageBox.java

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Perez
  • Date: 2009-12-07 10:22:24 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20091207102224-70w2tax575mcks1w
Tags: 3.5.1-1
* New upstream release. Closes: #558663.
* debian/control: 
  - Add Vcs-* fields for Git repository.
  - Allow DM-Uploads.
  - Remove "Conflicts", package should live with eclipse.
* debian/rules: Fix default-java path around AWT_LIB_PATH.
* debian/copyright: Minor update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
 
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
3
 * All rights reserved. This program and the accompanying materials
4
4
 * are made available under the terms of the Eclipse Public License v1.0
5
5
 * which accompanies this distribution, and is available at
37
37
 *
38
38
 * @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Dialog tab</a>
39
39
 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
 
40
 * @noextend This class is not intended to be subclassed by clients.
40
41
 */
41
42
public class MessageBox extends Dialog {
42
43
 
81
82
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
82
83
 *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
83
84
 * </ul>
 
85
 * 
 
86
 * @see SWT#ICON_ERROR
 
87
 * @see SWT#ICON_INFORMATION
 
88
 * @see SWT#ICON_QUESTION
 
89
 * @see SWT#ICON_WARNING
 
90
 * @see SWT#ICON_WORKING
 
91
 * @see SWT#OK
 
92
 * @see SWT#CANCEL
 
93
 * @see SWT#YES
 
94
 * @see SWT#NO
 
95
 * @see SWT#ABORT
 
96
 * @see SWT#RETRY
 
97
 * @see SWT#IGNORE
84
98
 */
85
99
public MessageBox (Shell parent, int style) {
86
100
        super (parent, checkStyle (parent, checkStyle (style)));
147
161
                        OS.g_list_free (pixbufs);
148
162
                }
149
163
        }
150
 
        createButtons();
 
164
        Display display = parent != null ? parent.getDisplay (): Display.getCurrent ();
 
165
        createButtons (display.getDismissalAlignment ());
151
166
        buffer = Converter.wcsToMbcs(null, title, true);
152
167
        OS.gtk_window_set_title(handle,buffer);
153
 
        Display display = parent != null ? parent.getDisplay (): Display.getCurrent ();
154
168
        display.addIdleProc ();
155
169
        Dialog oldModal = null;
156
170
        if (OS.gtk_window_get_modal (handle)) {
175
189
        return response;
176
190
}
177
191
 
178
 
private void createButtons() {
179
 
        if ((style & SWT.OK) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-ok", true), SWT.OK);
180
 
        if ((style & SWT.CANCEL) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-cancel", true), SWT.CANCEL);
181
 
        if ((style & SWT.YES) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-yes", true), SWT.YES);
182
 
        if ((style & SWT.NO) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-no", true), SWT.NO);
183
 
        if ((style & SWT.ABORT) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Abort"), true), SWT.ABORT);
184
 
        if ((style & SWT.RETRY) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true), SWT.RETRY);
185
 
        if ((style & SWT.IGNORE) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Ignore"), true), SWT.IGNORE);
 
192
private void createButtons (int alignment) {
 
193
        if (alignment == SWT.LEFT) {
 
194
                if ((style & SWT.OK) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-ok", true), SWT.OK);
 
195
                if ((style & SWT.ABORT) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Abort"), true), SWT.ABORT);
 
196
                if ((style & SWT.RETRY) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true), SWT.RETRY);
 
197
                if ((style & SWT.YES) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-yes", true), SWT.YES);
 
198
                if ((style & SWT.NO) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-no", true), SWT.NO);
 
199
                if ((style & SWT.IGNORE) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Ignore"), true), SWT.IGNORE);
 
200
                if ((style & SWT.CANCEL) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-cancel", true), SWT.CANCEL);
 
201
        } else {                
 
202
                if ((style & SWT.CANCEL) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-cancel", true), SWT.CANCEL);
 
203
                if ((style & SWT.OK) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-ok", true), SWT.OK);
 
204
                if ((style & SWT.NO) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-no", true), SWT.NO);
 
205
                if ((style & SWT.YES) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, "gtk-yes", true), SWT.YES);
 
206
                if ((style & SWT.IGNORE) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Ignore"), true), SWT.IGNORE);
 
207
                if ((style & SWT.RETRY) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Retry"), true), SWT.RETRY);
 
208
                if ((style & SWT.ABORT) != 0) OS.gtk_dialog_add_button(handle, Converter.wcsToMbcs (null, SWT.getMessage("SWT_Abort"), true), SWT.ABORT);
 
209
        }
186
210
}
187
211
 
188
212
private static int checkStyle (int style) {