1 /**
2 * MicroEmulator
3 * Copyright (C) 2001-2007 Bartek Teodorczyk <barteo@barteo.net>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @version $Id: ConnectionClosedException.java 877 2007-02-13 02:24:09Z vlads $
20 */
21 package org.microemu.app.ui.swt;
22
23 import org.eclipse.swt.widgets.Shell;
24 import org.microemu.app.ui.Message;
25 import org.microemu.app.ui.MessageListener;
26
27 public class SwtErrorMessageDialogPanel implements MessageListener {
28
29 private Shell shell;
30
31 public SwtErrorMessageDialogPanel(Shell shell) {
32 this.shell = shell;
33 }
34
35 public void showMessage(int level, String title, String text, Throwable throwable) {
36
37 int messageType;
38 switch (level) {
39 case Message.ERROR:
40 messageType = SwtMessageDialog.ERROR;
41 break;
42 case Message.WARN:
43 messageType = SwtMessageDialog.WARNING;
44 break;
45 default:
46 messageType = SwtMessageDialog.INFORMATION;
47 }
48 SwtMessageDialog.openMessageDialog(shell, title, text, messageType);
49 }
50
51 }