| 1 | package de.uka.ipd.sdq.dsexplore.helper; |
| 2 | |
| 3 | import org.eclipse.core.runtime.Status; |
| 4 | import org.eclipse.jface.dialogs.MessageDialog; |
| 5 | import org.eclipse.swt.widgets.Display; |
| 6 | import org.eclipse.ui.PlatformUI; |
| 7 | |
| 8 | import de.uka.ipd.sdq.dsexplore.DSEPluginActivator; |
| 9 | |
| 10 | public class DSEMessageBox implements Runnable { |
| 11 | |
| 12 | private String title; |
| 13 | private String message; |
| 14 | private int dialogImageType; |
| 15 | |
| 16 | public DSEMessageBox(String title, String message, int dialogImageType) { |
| 17 | super(); |
| 18 | this.title = title; |
| 19 | this.message = message; |
| 20 | this.dialogImageType = dialogImageType; |
| 21 | } |
| 22 | |
| 23 | @Override |
| 24 | public void run() { |
| 25 | MessageDialog dlg = new MessageDialog(PlatformUI.getWorkbench() |
| 26 | .getActiveWorkbenchWindow().getShell(), title, null, message, |
| 27 | dialogImageType, new String[] { "Ok" }, 1); |
| 28 | dlg.open(); |
| 29 | |
| 30 | } |
| 31 | |
| 32 | public static void showMessage(String title, String message, int dialogType) { |
| 33 | Display display = Display.getDefault(); |
| 34 | |
| 35 | DSEPluginActivator.log(Status.OK, message); |
| 36 | |
| 37 | display.syncExec(new DSEMessageBox(title, message, dialogType)); |
| 38 | } |
| 39 | |
| 40 | } |