Commit | Line | Data |
---|---|---|
05e0d2e9 GB |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 École Polytechnique de Montréal | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Geneviève Bastien - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.ui.project.model; | |
14 | ||
15 | import org.eclipse.swt.widgets.Display; | |
16 | import org.eclipse.swt.widgets.MessageBox; | |
17 | import org.eclipse.ui.PlatformUI; | |
18 | ||
19 | /** | |
20 | * Utility class for common tmf.ui functionalities | |
21 | * | |
22 | * @since 2.1 | |
23 | */ | |
24 | public class TraceUtils { | |
25 | ||
26 | /** | |
27 | * Displays an error message in a box | |
28 | * | |
29 | * @param boxTitle | |
30 | * The message box title | |
31 | * @param errorMsg | |
32 | * The error message to display | |
33 | */ | |
34 | public static void displayErrorMsg(final String boxTitle, final String errorMsg) { | |
35 | Display.getDefault().asyncExec(new Runnable() { | |
36 | @Override | |
37 | public void run() { | |
38 | final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); | |
39 | mb.setText(boxTitle); | |
40 | mb.setMessage(errorMsg); | |
41 | mb.open(); | |
42 | } | |
43 | }); | |
44 | } | |
45 | } |