2
* Created on 20-dic-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.gui.util;
9
import org.eclipse.swt.SWT;
10
import org.eclipse.swt.widgets.MessageBox;
11
import org.eclipse.swt.widgets.Shell;
12
import org.herac.tuxguitar.gui.TuxGuitar;
13
import org.herac.tuxguitar.gui.actions.ActionLock;
14
import org.herac.tuxguitar.gui.helper.SyncThread;
19
* TODO To change the template for this generated type comment go to
20
* Window - Preferences - Java - Code Style - Code Templates
22
public class MessageDialog {
26
private String message;
28
protected MessageDialog(String name,String message,int style){
30
this.message = message;
34
protected void show(Shell parent){
35
MessageBox messageBox = new MessageBox(parent, this.style);
36
messageBox.setText(this.name);
37
messageBox.setMessage(this.message);
41
public static void infoMessage(final String title,final String message){
42
MessageDialog.infoMessage(TuxGuitar.instance().getShell(), title, message);
45
public static void infoMessage(final Shell shell,final String title,final String message){
46
new SyncThread(new Runnable() {
48
if(!shell.isDisposed()){
49
new MessageDialog(title,message,SWT.ICON_INFORMATION).show(shell);
55
public static void errorMessage(final Throwable throwable){
56
MessageDialog.errorMessage(TuxGuitar.instance().getShell(),throwable);
59
public static void errorMessage(final Shell shell,final Throwable throwable){
60
MessageDialog.errorMessage(shell, (throwable.getMessage() != null ? throwable.getMessage() : throwable.getClass().getName() ));
61
new Thread(new Runnable() {
63
throwable.printStackTrace();
68
public static void errorMessage(final Shell shell,final String message){
69
if(!shell.isDisposed()){
70
new SyncThread(new Runnable() {
72
if(!shell.isDisposed()){
74
TuxGuitar.instance().unlock();
75
shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));
76
new MessageDialog(TuxGuitar.getProperty("error"),message,SWT.ICON_ERROR).show(shell);