01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id$
23: */
24: package com.bostechcorp.cbesb.ui.util;
25:
26: import org.eclipse.swt.SWT;
27: import org.eclipse.swt.widgets.MessageBox;
28: import org.eclipse.swt.widgets.Shell;
29: import org.eclipse.ui.PlatformUI;
30:
31: import com.bostechcorp.cbesb.common.i18n.I18N;
32: import com.bostechcorp.cbesb.common.i18n.Messages;
33:
34: public class MsgUtil {
35:
36: public static int confirmDialog(Shell parent, String msg) {
37: MessageBox msgBox = new MessageBox(parent, SWT.ICON_INFORMATION
38: | SWT.OK | SWT.CANCEL);
39: msgBox.setText(I18N.getString(Messages.CONFIRM));
40: msgBox.setMessage(msg);
41: return msgBox.open();
42: }
43:
44: public static int confirmDialog(String msg, String tip) {
45: MessageBox msgBox = new MessageBox(PlatformUI.getWorkbench()
46: .getActiveWorkbenchWindow().getShell(),
47: SWT.ICON_INFORMATION | SWT.OK | SWT.CANCEL);
48: msgBox.setText(tip);
49: msgBox.setMessage(msg);
50: return msgBox.open();
51: }
52:
53: public static int confirmDialog(String msg, int style) {
54: MessageBox msgBox = new MessageBox(PlatformUI.getWorkbench()
55: .getActiveWorkbenchWindow().getShell(), style);
56: msgBox.setText(I18N.getString(Messages.CONFIRM));
57: msgBox.setMessage(msg);
58: return msgBox.open();
59: }
60:
61: public static int confirmMsg(String msg) {
62: MessageBox msgBox = new MessageBox(PlatformUI.getWorkbench()
63: .getActiveWorkbenchWindow().getShell(),
64: SWT.ICON_INFORMATION | SWT.OK);
65: msgBox.setText(I18N.getString(Messages.CONFIRM));
66: msgBox.setMessage(msg);
67: return msgBox.open();
68: }
69:
70: public static int confirmMsg(Shell parent, String msg) {
71: MessageBox msgBox = new MessageBox(parent, SWT.ICON_INFORMATION
72: | SWT.OK);
73: msgBox.setText(I18N.getString(Messages.CONFIRM));
74: msgBox.setMessage(msg);
75: return msgBox.open();
76: }
77:
78: public static void warningMsg(String msg) {
79: MessageBox msgBox = new MessageBox(PlatformUI.getWorkbench()
80: .getActiveWorkbenchWindow().getShell(),
81: SWT.ICON_WARNING | SWT.OK);
82: msgBox.setText(I18N.getString(Messages.WARNING));
83: msgBox.setMessage(msg);
84: msgBox.open();
85: }
86: }
|