Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 40de170e1c753008b9f032cd1dd1bea74dc4c3dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.eclipse.linuxtools.systemtap.ui.consolelog.dialogs;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.PlatformUI;

/**
 * Creates and displays an error message box that runs in the UI thread.
 *
 */
public class ErrorMessage {
	private String title;
	private String error;
	
	public ErrorMessage(String title, String error) {
		this.title = title;
		this.error = error;
	}
	
	public void open() {
		Display.getDefault().syncExec(new Runnable() {
			public void run() {  		
				MessageBox messageBox = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.ICON_ERROR | SWT.OK);
				messageBox.setMessage(error);
				messageBox.setText(title);
				messageBox.open();
			} // end run	
		}); // end new Runnable
	}
}

Back to the top